android - OnItemSelectedListener not working for spinner -
I have a spinner that I set up using a custom ArrayAdapter: It has been started as (spinner spinner; statement is above the class variable): I have implemented Onim Select Listener: and the required callbacks are: XML for spinner: The problem is that whenever any item is chosen from the spinner, nothing happens, even I have removed all the conditions as you can see above Are there.
Private static Class Custom Adapter & lt; T & gt; Extension of array adapter & lt; String & gt; {Public Custed Adapter (Reference Reference, Int TextVersourceSource Id, String [] Objects) {Super (context, text WEVRSourceID, Objects); } View public ViewViewView (View int Status, see ViewGroup Parents) {View View = super.getView (Status, ConvertView, Parents); TextView textView = (TextView) view.findViewById (android.R.id.text1); TextView.setText (""); Return view; }
this.spinner = (spinner ) FindViewById (R.id.spinner1); CustomAdapter & LT; String & gt; Adapters = new custom adapter & lt; String & gt; (This, android.R.layout.simple_spinner_dropdown_item, new string [] {"set home page"}); Spinner.setAdapter (adapter); Spinner.setOnItemSelectedListener (this);
increases the public class main activity activity tools IItemSelectedListener {...}
// spinner methods @ override selected items on public zeros (adapterview & lt;? & Gt; parent, see view, int paus , Long ID) {// Tudo Auto-Generated Method Stub // if (pos == 1) {toast.makeText ("This person wants to change the homepage", Toast. LNGHI HRARAR). Show (); //}} @ Override public zeros on any selection (adapterview
Android spinner: id = "@ + id / spinner1" Android: layout_width = "45dp" Android: Layout_height = "45dp" Android: background = "@drawable / ic_menu_motoroverflow_holo_dark" />
OnTime is not working for simplified listener spinner
Because you are passing only one item in the adapter selected by default, maybe you are getting toast messages when launching your application.
To add more elements to check onItemSelectedListener
behavior.
Comments
Post a Comment