Android get elements from json array -


i'm trying elements json array.

this json response:

{"ids":["635426812801493839","635429094450867472","635433640807558204"]} 

this i've tried far:

itemlist = new arraylist<hashmap<string, string>>();              jsonarray = jsonobj.getjsonarray(constants.ids);             int arrsize = a.length();             arraylist<string> stringarray = new arraylist<string>();             (int = 0; < arrsize; ++i) {                 jsonobject obj = a.getjsonobject(i);                 stringarray.add(obj.tostring());                 item = new hashmap<string, string>();                 item.put(constants.id, obj.tostring());                 itemlist.add(item);             }              log.e("arr count", "" + stringarray.size()); 

but i'm getting empty list. wrong code? appreciated. thanks.

the loop should be

for (int = 0; < arrsize; ++i) {       stringarray.add(a.getstring(i)); 

your jsonarray contains string


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -