Open navigation drawer when options menu button is pressed

It is easy to open the navigation drawer from option menu. Place the following code in your main activity class.

[code lang=”java”]
public boolean onKeyDown(int keyCode, KeyEvent e)
if (keyCode == KeyEvent.KEYCODE_MENU)
if (!mDrawerLayout.isDrawerOpen(mDrawerLinear))
return true;
return super.onKeyDown(keyCode, e);

About the author

Janaki( - A Software developer with 9+ years of experience in multiple technology projects across web, mobile, and cloud applications with expertise in PHP, C#, MySQL, Web services and open source platforms.

Similar Posts

Leave a reply


Eye Test: * Time limit is exhausted. Please reload CAPTCHA.