简体   繁体   中英

Disable device back button on SOME page [jquery mobile / android]

I need some approach advice on how to handle this. I had multi-pages app, Login page, Register page, After Logged In Page and on...

Now I found out, after user logged in, I check the login into and programmatically redirect the user to the After Logged In Main Page.

The problem start here, on Android, the user can use the device back button to return to the Login Page which is not logical.

The question, how I can prevent Device Back button ONLY on the "After Logged in Page" to avoid user go back to Login Page. Other back I would like to allow user to user device back button to navigate.

In other words, I need to disable Device Back button on some page, not all page. Please advice, thank you.

Lesz

You can put this in your Activity to disable the back button completely.

@Override
public void onBackPressed() {
    return;
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM