如何在单独的行中显示每个列表元素

时间:2018-07-20 10:34:50

标签: java android json retrofit2

我该如何发展呢?。

  "section_items": [
                {
                    "item_id": 190,
                    "item_type": 1,
                    "is_directive": 0,
                    "directive_content": {},
                    "hints": "scientists",
                    "item": [
                        {
                            "data_id": 877,
                            "data_format_id": 1,
                            "data_format_value": "Why haven't Indian scientists made such headway in any field after independence ?",
                            "item_df_sequence": 1,
                            "data_identifier": null
                        },
                        {
                            "data_id": 878,
                            "data_format_id": 1,
                            "data_format_value": "Indian scientists are not provided with up to date laboratory facilities.",
                            "item_df_sequence": 2,
                            "data_identifier": null
                        },
                        {
                            "data_id": 879,
                            "data_format_id": 1,
                            "data_format_value": "Indian scientists regard that knowledge of western science advances is enough for a nation to advance.",
                            "item_df_sequence": 3,
                            "data_identifier": null
                        }
                    ],
                    "answer_choices": [
                        {
                            "correct_answer": false,
                            "answer_choice_id": 4,
                            "choice_elements": [
                                {
                                    "data_id": 883,
                                    "data_format_id": 1,
                                    "data_format_value": "data given in both statements I and II together are not sufficient to answer the question. ",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 1
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 2,
                            "choice_elements": [
                                {
                                    "data_id": 881,
                                    "data_format_id": 1,
                                    "data_format_value": "data in statement II alone are sufficient to answer the question.",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 2
                        },
                        {
                            "correct_answer": true,
                            "answer_choice_id": 1,
                            "choice_elements": [
                                {
                                    "data_id": 880,
                                    "data_format_id": 1,
                                    "data_format_value": "data in statement I alone are sufficient to answer the question.",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 3
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 3,
                            "choice_elements": [
                                {
                                    "data_id": 882,
                                    "data_format_id": 1,
                                    "data_format_value": "data either in statement I alone or in statement II alone are sufficient to answer the question.",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 4
                        }
                    ],
                    "Answer_Choice_Type": "Single Answer",
                    "score_type": "Item Lvl Score",
                    "ItemSet_Item_Key": 273,
                    "yet_to_visit": 0,
                    "filterCategory": "red",
                    "mark_for_review": 0,
                    "not_answered": 1,
                    "answered": 0,
                    "answered_marked_for_review": 0,
                    "seq_no": 1,
                    "hints_shown": "n",
                    "user_selected_option": []
                },
                {
                    "item_id": 194,
                    "item_type": 1,
                    "is_directive": 0,
                    "directive_content": {},
                    "hints": "Martin",
                    "item": [
                        {
                            "data_id": 902,
                            "data_format_id": 1,
                            "data_format_value": "Choose the options which are related to Martin Luther king",
                            "item_df_sequence": 1,
                            "data_identifier": null
                        }
                    ],
                    "answer_choices": [
                        {
                            "correct_answer": false,
                            "answer_choice_id": 4,
                            "choice_elements": [
                                {
                                    "data_id": 5,
                                    "data_format_id": 11,
                                    "data_format_value": "https://awspikaresources.s3.ap-south-1.amazonaws.com/TenantsDetails/Tech4india2018-06-16/TenantFilesContent/Videos/c197557324c98e22b7500569745b28f11530684091.mp4",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 1
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 2,
                            "choice_elements": [
                                {
                                    "data_id": 903,
                                    "data_format_id": 1,
                                    "data_format_value": "In attaining our ideals,our means should be as pure as the end",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 2
                        },
                        {
                            "correct_answer": true,
                            "answer_choice_id": 1,
                            "choice_elements": [
                                {
                                    "data_id": 9,
                                    "data_format_id": 6,
                                    "data_format_value": "https://awspikaresources.s3.ap-south-1.amazonaws.com/TenantsDetails/Tech4india2018-06-16/TenantFilesContent/Images/7f27faaaa7379e5b0451b942784eb6ba1530684225.jpeg",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 3
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 3,
                            "choice_elements": [
                                {
                                    "data_id": 4,
                                    "data_format_id": 10,
                                    "data_format_value": "https://awspikaresources.s3.ap-south-1.amazonaws.com/TenantsDetails/Tech4india2018-06-16/TenantFilesContent/Audios/60662315eb02ada997639552ee14ad4e1530684068.mp3",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 4
                        }
                    ],
                    "Answer_Choice_Type": "Single Answer",
                    "score_type": "Item Lvl Score",
                    "ItemSet_Item_Key": 276,
                    "yet_to_visit": 1,
                    "filterCategory": "gray",
                    "mark_for_review": 0,
                    "not_answered": 0,
                    "answered": 0,
                    "answered_marked_for_review": 0,
                    "seq_no": 2,
                    "hints_shown": "n",
                    "user_selected_option": []
                },
                {
                    "item_id": 193,
                    "item_type": 1,
                    "is_directive": 0,
                    "directive_content": {},
                    "hints": "synthesised",
                    "item": [
                        {
                            "data_id": 897,
                            "data_format_id": 1,
                            "data_format_value": "Which of the following is the newest element to be discovered and synthesised?",
                            "item_df_sequence": 1,
                            "data_identifier": null
                        },
                        {
                            "data_id": 4,
                            "data_format_id": 11,
                            "data_format_value": "https://awspikaresources.s3.ap-south-1.amazonaws.com/TenantsDetails/Tech4india2018-06-16/TenantFilesContent/Videos/61e0158cde97a6f2e3a9f3a7c5d81ccf1530684346.mp4",
                            "item_df_sequence": 2,
                            "data_identifier": null
                        }
                    ],
                    "answer_choices": [
                        {
                            "correct_answer": false,
                            "answer_choice_id": 1,
                            "choice_elements": [
                                {
                                    "data_id": 898,
                                    "data_format_id": 1,
                                    "data_format_value": "Flerovium (114)",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 1
                        },
                        {
                            "correct_answer": true,
                            "answer_choice_id": 4,
                            "choice_elements": [
                                {
                                    "data_id": 901,
                                    "data_format_id": 1,
                                    "data_format_value": "Ununseptium (117)",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 2
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 2,
                            "choice_elements": [
                                {
                                    "data_id": 899,
                                    "data_format_id": 1,
                                    "data_format_value": "Ununpentium (115)",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 3
                        },
                        {
                            "correct_answer": false,
                            "answer_choice_id": 3,
                            "choice_elements": [
                                {
                                    "data_id": 900,
                                    "data_format_id": 1,
                                    "data_format_value": "Livermorium (116)",
                                    "item_df_sequence": 1,
                                    "data_identifier": null
                                }
                            ],
                            "choosed_answer": false,
                            "seq_id": 4
                        }
                    ],
                    "Answer_Choice_Type": "Single Answer",
                    "score_type": "Item Lvl Score",
                    "ItemSet_Item_Key": 275,
                    "yet_to_visit": 1,
                    "filterCategory": "gray",
                    "mark_for_review": 0,
                    "not_answered": 0,
                    "answered": 0,
                    "answered_marked_for_review": 0,
                    "seq_no": 3,
                    "hints_shown": "n",
                    "user_selected_option": []
                },
                {
                    "item_id": 195,
                    "item_type": 2,
                    "is_directive": 0,
                    "directive_content": {},
                    "hints": "anti-tetanus ",
                    "item": [
                        {
                            "data_id": 904,
                            "data_format_id": 1,
                            "data_format_value": "Blueberries cost more than strawberries",
                            "item_df_sequence": 1,
                            "data_identifier": null
                        },
                        {
                            "data_id": 905,
                            "data_format_id": 1,
                            "data_format_value": "Blueberries cost less than raspberries.",
                            "item_df_sequence": 2,
                            "data_identifier": null
                        },
                        {
                            "data_id": 906,
                            "data_format_id": 1,
                            "data_format_value": "Raspberries cost more than strawberries and blueberries",
                            "item_df_sequence": 3,
                            "data_identifier": null
                        },
                        {
                            "data_id": 907,
                            "data_format_id": 1,
                            "data_format_value": "If the first two statements are true, the third statement is",
                            "item_df_sequence": 4,
                            "data_identifier": null
                        }
                    ],
                    "answer_choices": [
                        {
                            "data_id": 8,
                            "data_format_id": 1,
                            "data_format_value": "True",
                            "answer_choice_id": 1,
                            "item_df_sequence": 1,
                            "data_identifier": null,
                            "correct_answer": true,
                            "choosed_answer": false,
                            "seq_id": 1
                        },
                        {
                            "data_id": 9,
                            "data_format_id": 1,
                            "data_format_value": "False",
                            "answer_choice_id": 2,
                            "item_df_sequence": 2,
                            "data_identifier": null,
                            "correct_answer": false,
                            "choosed_answer": false,
                            "seq_id": 2
                        }
                    ],
                    "Answer_Choice_Type": "Single Answer",
                    "score_type": "Item Lvl Score",
                    "ItemSet_Item_Key": 277,
                    "yet_to_visit": 1,
                    "filterCategory": "gray",
                    "mark_for_review": 0,
                    "not_answered": 0,
                    "answered": 0,
                    "answered_marked_for_review": 0,
                    "seq_no": 4,
                    "hints_shown": "n",
                    "user_selected_option": []
                },

这是我的api。我要显示此类型的data_format_value。

1。为什么印度科学家在独立后没有在任何领域取得如此进展? 没有为印度科学家提供最新的实验室设施。印度科学家认为,西方科学的进步足以使一个国家前进。

2。选择与马丁·路德·金有关的选项

3。以下哪些是要发现和合成的最新元素?

我如何显示以上数值

1 个答案:

答案 0 :(得分:1)

首先,您必须使用此方法分割输入字符串:

String[] separated = inputString.split(",");
separated[0]; 
separated[1];
seperated[2];

一旦获得分隔的字符串,就可以在文本视图中根据需要使用listview适配器设置字符串。