java - how to convert arraylist data to string array in android -


here i'm trying latitude , longitude values json url stored in array can view logcat need values arraylist string array can load google map. if 1 know answer let me know pls....

            try {                 **arraylist1.clear();**                   jsonarray = json.getjsonarray("latlogvalu");                  log.d("haaaaaaaaaaaa", ""+json);                  (int = 0; < jsonarray.length(); i++) {                      log.d("h11111111111111111111111111", ""+jsonarray.length());                     **hashmap<string, string> map = new hashmap<string, string>();                     json = jsonarray.getjsonobject(i);                       map.put("pubname", json.getstring("pubname"));                     map.put("pubid", json.getstring("pubid"));                     map.put("lat", json.getstring("lat"));                      map.put("long", json.getstring("long"));                       arraylist1.add(map);**                   }               } catch (jsonexception e) {                 log.e("log_tag", "error parsing data " + e.tostring());                 log.e("error_^>^>^>^>^>^>^>^>^^>^>^^>^", "failed data was:\n" + result);                 e.printstacktrace();             } 

you can this:

public string[] toarray(arraylist<hashmap<string, string>> list){     string[] strarray = new string[list.size() * 2];     int = 0;     (hashmap<string, string> map : list) {         strarray[i++] = map.get("lat");         strarray[i++] = map.get("long");     }     return strarray; } 

Comments

Popular posts from this blog

android - Gradle sync Error:Configuration with name 'default' not found -

java - Andrioid studio start fail: Fatal error initializing 'null' -

html - jQuery UI Sortable - Remove placeholder after item is dropped -