找到你要的答案

Q:Destroy previous activity when user logged in

Q:在用户登录时销毁以前的活动

I am having two activities, login.java and home.java, The user Sign in with login.java, after successful login, the user will be redirected to home.java. If the user presses back button when he is in home activity, app is moving back to login activity. How to avoid redirecting back to Login page instead of closing the Application ?

我有两个活动,login.java和home.java、用户登录与login.java,登录成功后,用户将被重定向到home.java。如果用户在家中活动时按下“后退”按钮,应用程序将返回到登录活动。如何避免重定向到登录页面而不是关闭应用程序吗?

answer1: 回答1:

After starting the new activity call finish() http://developer.android.com/reference/android/app/Activity.html#finish()

After starting the new activity call finish() http://developer.android.com/reference/android/app/Activity.html#finish()

java  android  xml