注销后,用户将被定向到 android 中的登录屏幕。现在,如果用户点击手机的后退按钮,它应该留在登录屏幕本身。
如何在 android 中实现它?
我在我的应用程序中使用了以下代码,但它会关闭我的应用程序。它应该只停留在登录屏幕上
Intent objsignOut = new Intent(getBaseContext(),Hello.class);
objsignOut.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(objsignOut);
请指导我正确的方法。
在您的登录 Activity 中覆盖 onBackPressed
,什么也不做......
public void onBackPressed() {
//do nothing
}
关于java - 在android中注销后防止返回按钮,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13640891/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (https://www.ogeek.cn/) | Powered by Discuz! X3.4 |