Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Navigation drawer will close even if overwrite onBackPressed()

Is there a way to prevent navigation drawer from closing when back button is pressed? For testing purpose I make the call to onBackPressed() empty

@Override
public void onBackPressed() {

}

but the navigation drawer still responds to the back button and close. Other cases the back button is non-responsive as I expected. What should I overwrite in order to prevent navigation drawer from closing?

like image 710
Neoh Avatar asked Jun 07 '13 03:06

Neoh


1 Answers

Call in onCreate() in your activity

mDrawerLayout.setFocusableInTouchMode(false);

and handle the closing/opening logic yourself in OnBackPressed().

like image 124
Dennis Avatar answered Nov 10 '22 16:11

Dennis