Is there a way to convert JSON Array to normal Java Array for android ListView data binding?
|
|||||||||||||
|
If you don't already have a JSONArray object, call
Then simply loop through that, building your own array. This code assumes it's an array of strings, it shouldn't be hard to modify to suit your particular array structure.
|
|||||||||||||
|
Maybe it's only a workaround (not very efficient) but you could do something like this:
Obviously you can change the ' |
|||||||||
|
I know that question is about JSONArray but here's example I've found useful where you don't need to use JSONArray to extract objects from JSONObject.
Works also with array of strings |
||||
|
Here is a better way of doing it: if you are getting the data from API. Then PARSE the JSON and loading it onto your listview:
|
|||
|
Instead of using bundled-in
|
|||
|
How about using java.util.Arrays?
|
|||||||||
|