android - Spinner OnItemSelected doesn't work -


i've reviewed code several times , tried different "solutions", none of them worked. problem listener never get's fired when item clicked. found out when item clicked appears in logcat:

window focused, ignoring focus gain of: com.android.internal.view.iinputmethodclient$stub$proxy@40683498

the spinner created dynamically in function fired button.

code :

public void showfiltercountries(view v){       spinner country_list=new spinner(this);       arrayadapter<string> adapter= new arrayadapter<string>(this, android.r.layout.simple_spinner_item, countries);      adapter.setdropdownviewresource(android.r.layout.simple_spinner_dropdown_item);      country_list.setadapter(adapter);      country_list.setprompt("select country");       country_list.setonitemselectedlistener(new onitemselectedlistener() {             public void onitemselected(adapterview<?> arg0, view arg1,                     int pos, long arg3) {                 log.d("","selected");                                }              public void onnothingselected(adapterview<?> arg0) {                 log.d("","none selected");             }         });       country_list.performclick();     } 

i solved using alertdialog.builder instead of spinner (which right way), this:

https://stackoverflow.com/a/7635966/1181261


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -