Or just call Activity.openOptionsMenu()?
Apparently, doing it in onCreate breaks app, since Activity's not yet attached to a window. If you do it like so:
@Override
public void onAttachedToWindow() {
openOptionsMenu();
};
...it works.
For developers using the new Toolbar
class of the Support Library
, this is how it's done:
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
toolbar.showOverflowMenu();
Put this line of code in your onResume(), this should help!
new Handler().postDelayed(new Runnable() {
public void run() {
openOptionsMenu();
}
}, 1000);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With