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

天大地大妈咪最大 提交于 2019-12-13 21:22:58

问题


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


回答1:


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

@Override
public void onBackPressed() {
    return;
}


来源:https://stackoverflow.com/questions/22086380/disable-device-back-button-on-some-page-jquery-mobile-android

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!