java - Android Spinner GetSelection -


i work android project. small code

      //spinadapter custom class         spinadapter fromadapter = new spinadapter(getactivity(), 0, new arraylist<cities>());             // private spinner mfrom;          mfrom.setadapter(fromadapter);           asynchttpclient.get(url, null, new httpresponsehandler() {             @override             public void onoperationsuccess(string response) {                 type listoftestobject = new typetoken<arraylist<cities>>() {                 }.gettype();                 arraylist<cities> list = new gson().fromjson(response, listoftestobject);                 fromadapter.addall(list);                cities selectionid=mfrom.getselection()             }              @override             public void onfailure(string message) {              }         }); 

var selectionid null ? why?

can me?

for spinner need use getselecteditem(), not getselection()

you can string getselecteditem().tostring()


Comments

Popular posts from this blog

c# - SharpSsh Command Execution -

python - Specify path of savefig with pylab or matplotlib -

How to run C# code using mono without Xamarin in Android? -