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?
Call in onCreate() in your activity
mDrawerLayout.setFocusableInTouchMode(false);
and handle the closing/opening logic yourself in OnBackPressed().
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