How To Get Json Object As Per Spinner Selection
I am getting name and date in my spinner from this response,now what i am trying is if user select lily from spinner then i want to get occ value in string,but i am not getting it,
Solution 1:
Here:
testlist=new ArrayList<String>();
if(occs!=null)
testlist.add(occs);
these lines causing issue, because testlist
is initializing every time. move testlist
initialization out-side for-loop
:
jsonObj = new JSONArray(jsonStr);
testlist=new ArrayList<String>();
for (int i = 0; i < jsonObj.length(); i++) {
//... your code here for json parsing if(occs!=null)
testlist.add(occs);
else
testlist.add("");
}
Post a Comment for "How To Get Json Object As Per Spinner Selection"