1

I have to problems:

• When the user taps on the three dots (the overflow menu), I don't want the app to display a menu. Instead I want it to do an action instantly.

• The action should be a change to the AppTheme. So when the user taps on the overflow menu, the app theme changes to dark, if the user taps it again to light, etc.

  • 2
    Adding a different behavior to a well known part of the user interface reeks of a bad design choice. Is there a reason why you want the overflow menu *not* to be what it is? – David Medenjak Jan 23 '16 at 20:55
  • @DavidMedenjak is completely correct. It should be an icon that represents the action it does. – Eugene H Jan 23 '16 at 20:56
  • @DavidMedenjak I know how to change the overflow menu icon and I'll change it to a palette icon, so everything's fine. –  Jan 23 '16 at 21:09

1 Answers1

1

Since it's not a good way or as @David Medenjak said, it might be a different design or bad design (something like out of the rules).

By the way, you can use this for handling that OverflowMenu:

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
   super.onPrepareOptionsMenu(menu);

   if (disableMenu())
      Toast.makeText(this, "Clicked", Toast.LENGTH_SHORT).show();

   return true;
}

And then use the following answer:

https://stackoverflow.com/a/18301723/4409113

Finally, use the following link for checking what the current theme is and at the end, set your theme.

Hope that helps.

Community
  • 1
  • 1
ʍѳђઽ૯ท
  • 16,646
  • 7
  • 53
  • 108