Android store json data from php in String[] -
i have json [{"id":"67","title":"1852","customlabel":"66479"}, {"id":"68","title":"1859","customlabel":"5478"}...]
now store "title"s in string[] in order pass autocompletetextview
i'm newbie , don't know how.
could me? appreciated. in advance.
you can like:
//you have jsonarray store in jsonarray object. int len = jsonarray.length(); string[] titles = new string[len]; (int = 0; < len; i++) { final jsonobject e = jsonarray.getjsonobject(i); titles[i] =e.getstring("title"); }
and set adapter autocompletetextview like:
arrayadapter<string> adapter = new arrayadapter<string>(this, android.r.layout.simple_dropdown_item_1line, titles); autocompletetextview textview = (autocompletetextview) findviewbyid(r.id.autocompletetextview1); textview.setadapter(adapter);
Comments
Post a Comment