简体   繁体   中英

Pop Activity From Stack onResume

When my program starts, it runs a mainActivity, which right away launches and loads data into another Activity. I do this because the data needs only be loaded once, in mainActivity, then sent along to the other activities!

So! With that being said, my problem is probably forseeable! When the user clicks back enough, he will get to this initial activity, and sit there... ungracefully, instead of going back to Android's main menu.

What I want to do is add something to the onResume() method of the mainActivity, so that when it is re-entered I "activate" the back button from within the code-- (a boolean flag makes sure I'm not doing this incorrectly, thus I know it was on a back click). So isn't this just popping the current Activity from the Activity Stack?

how do I pop an activity from the activity stack!

Thanks!

除了使用“ noHistory”属性,您还可以在启动下一个活动时调用finish()。当您单击“后退”按钮时,它不会重新出现。这将关闭第一个活动。从堆栈..

不使用任何历史记录选项,这样该活动就永远不会进入后退堆栈。

android:noHistory=["true" | "false"] 

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