android - Spinner getselecteditem from map -


public void querysql_process(string sqlcmd){

resultset rs;      try{          statement statement = connect.createstatement();         rs = statement.executequery(sqlcmd);          //configurar o simple adapter         list<map<string, string>> data = null;         data = new arraylist<map<string,string>>();          //resultset, todos os registros         while(rs.next()){             map<string, string> datanum = new hashmap<string, string>();             datanum.put("a", rs.getstring("id_process"));             datanum.put("b", rs.getstring("name"));             data.add(datanum);         }          string[] = {"a", "b"};         int[] cb_process = {r.id.tid_process, r.id.tprocessname};          //modelo layout         ad = new simpleadapter(this, data, r.layout.model_process, from, cb_process);          //carregar spinner processos com os dados banco         process.setadapter(ad); //process spinner      }catch (exception e){         log.e("error: ",e.getmessage());     }  } 

execute.setonclicklistener(new onclicklistener() {

        @override         public void onclick(view v) {             // todo auto-generated method stub              //quantidade de atendimentos             toast toast = toast.maketext(getapplicationcontext(),"process: "+process.getselecteditem()+"\nquantidade de atendimentos: "+ quantidade, toast.length_long);             toast.show();          }     }); 

tried code "onitemselected", selected string return "null".

process.setonitemselectedlistener(new onitemselectedlistener() {

        @override         public void onitemselected(adapterview<?> parent, view view,                 int position, long id) {             // todo auto-generated method stub             selected = (string) data.get(process.getselecteditemposition()).get("name");             toast toast = toast.maketext(getapplicationcontext(),"process: "+selected, toast.length_long);             toast.show();          }          @override         public void onnothingselected(adapterview<?> parent) {             // todo auto-generated method stub          }     }); 

hi, want know how "id_process" or "name" toast(process.getselecteditem()), using code above return this: process: {a=1, b=solicitados} return map postition. want know how recover id_process or name.

thanks


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -