How do I block the back button (that little arrow on the hardware)?

Asked

Viewed 4,547 times

3

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

1 answer

9


Just create the onBackPressed method and don’t charm the super of it, leaving only blank the body of the function. Ai every time the user presses the back button, nothing will happen.

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

Obs.: this method should only be written in Activity.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.