I'm using the ActionBar extending from the AppCompatActivity. How can I check, if the dropdown menu of the ActionBar is opened at the moment.
I've tried it in this method. But it does not fire if I open the drop down menu:
@Override
public boolean onOptionsItemSelected(MenuItem item) {
Intent intent = new Intent();
Log.i("ActionBar", "ActionBar dropdown is open at this moment");
switch (item.getItemId()) {
case R.id.preferences:
intent.setClass(StartupActivity.this, PreferencesActivity.class);
startActivityForResult(intent, 0);
return true;
case R.id.info:
intent.setClass(StartupActivity.this, InformationActivity.class);
startActivityForResult(intent, 0);
return true;
case R.id.contact:
intent.setClass(StartupActivity.this, ContactActivity.class);
startActivityForResult(intent, 0);
return true;
default:
return super.onOptionsItemSelected(item);
}
}
It only fires, if I click on an item of the drop down menu. But I want to check, if the user clicks on the three-dot menu.
I've tried this method, it works:
Even when initializing the menu, and not only when you click, but better than nothing.