android - Pop up a dynamic choice list when pressing a button -
i have little problem.
let's have edittext, button , arraylist of string x values.
when pressing on button, want pop choice list (like spinner) values of arraylist. then, string of choosen item , put in edittext.
how can this?
thank you.
try this:
ed= (edittext) findviewbyid(r.id.edit_text_box); ed.gettext().tostring(); public void thespinner() { yourspinner = (spinner) findviewbyid(r.id.spinner); arrayadapter<charsequence> adapter = arrayadapter.createfromresource (this, r.array."your array name", android.r.layout.simple_spinner_item); adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item); yourspinner.setadapter(adapter); } public void onitemselected(adapterview<?> yourspinner, view view,int pos, long id) { ed.settext(yourspinner.getselecteditem()); }
Comments
Post a Comment