打后退按钮在Android上时关闭应用程序上时、应用程序、按钮、Android

由网友(ⅰ亾dé卋堺)分享简介:所以我的登录活动就是你看到的第一个画面。当你点击后退按钮,它退出应用程序,不错。所以,我再次打开该应用程序。登录后,我现在在我的主要活动。我如何使它所以当我打的后退按钮现在,它退出应用程序,而不是要回登录活动?So my login Activity is the first screen you see. When...

所以我的登录活动就是你看到的第一个画面。当你点击后退按钮,它退出应用程序,不错。所以,我再次打开该应用程序。登录后,我现在在我的主要活动。我如何使它所以当我打的后退按钮现在,它退出应用程序,而不是要回登录活动?

So my login Activity is the first screen you see. When you hit the back button, it exits the app, good. So I open up the app again. After logging in, I am now in my main Activity. How do I make it so when I hit the back button now, it exits the app rather than going back to the login Activity?

推荐答案

在推新活动,呼吁previous完成(),否则将继续在堆栈上,因此出现当你打回来,弹出当前活动。

When you push the new activity, call finish() on the previous, otherwise it will remain on the stack, therefore appearing when you hit back and pop the current activity.

希望有所帮助。

阅读全文

相关推荐

最新文章