I am using the ActionBar drop-down navigation with the OnNavigationListener implemented. The requirement is to run the onNavigationItemSelected () method each time, also when the same dropdown item is selected. The default Android implementation prevents the onNavigationItemSelected () method from starting when the same item is selected.
I have seen solutions to this requirement only for the standard Spinner implementation here and here , but not for the specific ActionBar drop-down navigation.
Any suggestions on how to overcome this default Android behavior will be most valuable.
Here is my code:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPosition = -1; actionBar = getActionBar(); actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST); ....
and
@Override public boolean onCreateOptionsMenu(Menu menu) { MenuInflater inflater = getMenuInflater(); inflater.inflate(R.menu.eventmenu, menu); SpinnerAdapter mSpinnerAdapter = ArrayAdapter.createFromResource(actionBar.getThemedContext(), R.array.s_events, android.R.layout.simple_spinner_dropdown_item); OnNavigationListener mOnNavigationListener = new OnNavigationListener() { @Override public boolean onNavigationItemSelected(int position, long itemId) { if (mPosition > -1) {
source share