JSON object to listView

后端 未结 3 490
花落未央
花落未央 2020-12-07 03:20

i am newbie to android, I wanted to implement dynamically JSON data to my android listView, I have only to objects in JSON file this are dealname and discount.

I che

3条回答
  •  粉色の甜心
    2020-12-07 04:19

    You will need custom list adapter, and possibly custom list entry.

    Assuming you have already parsed your JSON and have JSON Array, this adapter will have to: - provide amoubnt of entries in JSON arary - create and populate entry views on demand for certain list entry identified by position. Keep in mind, that list entries are reusable ( and they should be reused to reduce amount of object alloaction)

    If there is a lot of data in JSON, better approach would be to use GSON pull parser and some databinding , to create java objects istead of built in JSON parser

提交回复
热议问题