Hi,, I'm new to android developing...
I'm developing a simple app that have 5 spinners.. when I select 1
item in a spinner I want to auto select other spinner items that
equals to the selected item position.
I used "setOnItemSelectedListner" and it worked for the 1st spinner..
but others don't work. here's my code for 1st 2 spinners. any
solution?????


spinner1.setOnItemSelectedListener(new OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parentView, View
selectedItemView, int position, long id) {
                int pos1=spinner1.getSelectedItemPosition();
                        spinner2.setSelection(pos1);
                        spinner3.setSelection(pos1);
                        spinner4.setSelection(pos1);
                        spinner5.setSelection(pos1);
             }

             public void onNothingSelected(AdapterView<?> arg0) {
             }
});

spinner2.setOnItemSelectedListener(new OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> parentView, View
selectedItemView, int position, long id) {
                int pos2=spinner2.getSelectedItemPosition();
                        spinner1.setSelection(pos2);
                        spinner3.setSelection(pos2);
                        spinner4.setSelection(pos2);
                        spinner5.setSelection(pos2);
            }

            public void onNothingSelected(AdapterView<?> arg0) {
            }
});

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to