Moin Khan Moin Khan - 1 year ago 66
Android Question

How to get value from selected spinner item from json?

I am getting selected spinner value response like below -

{cCodeName=abc, nSerialNo=1}

How can i get "1" from "nSerialNo" in variable ?

Answer Source

you need to parse json like below:

String response={cCodeName=abc, nSerialNo=1};
JsonObject obj=new JsonObject(response);
String serialNo=obj.getString("nSerialNo");

in serialNo you get value of your spinner

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download