indira indira - 1 year ago 95
Android Question

How can I get an event in Android Spinner when the current selected item is selected again?

I have written an setOnItemSelectedListener for spinner to respond when the spinner item is changed. My requirement is when I clicks again the currently selected item, a toast should display. How to get this event? When the currently selected item is clicked again, spinner is not responding. `

StorageSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener(){

public void onItemSelected(AdapterView adapter, View v, int i, long lng) {
Toast.makeText(getApplicationContext(), (CharSequence) StorageSpinner.getSelectedItem(), Toast.LENGTH_SHORT).show();


public void onNothingSelected(AdapterView arg0) {
Toast.makeText(getApplicationContext(), "Nothing selected", Toast.LENGTH_SHORT).show();


Answer Source

When you clicks again the currently selected item, then it can not fire any event. So you can not catch setOnItemSelectedListener for spinner to respond.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download