How do I lock the back button (that little set on the hardware)?

3

I need to block that arrow so the user does not come back, does anyone know how? Thank you in advance.

    
asked by anonymous 08.09.2015 / 17:41

1 answer

8

Just create the onBackPressed method and do not charm its super, leaving only the body of the function blank. Anytime the user presses the back button, nothing will happen.

@Override
public void onBackPressed() {
    // não chame o super desse método
}

Note: this method should only be written to Activity .

    
08.09.2015 / 17:50