我怎么能拒绝的活动被销毁 [英] How can i deny activity to be destroyed

查看:170
本文介绍了我怎么能拒绝的活动被销毁的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始从活动的A活动B。当我使用后退按钮或方法结束()关闭b活动,该活动A被重新创建。我怎么能拒绝活性被破坏?

I'm starting the activity "B" from the activity "A". When I'm closing the activity B using the back button or method finish(), the activity A is recreating. How can i deny activity to be destroyed?

推荐答案

在Android的活动都存储在堆栈叫活动栈,当你去到下一个活动它添加到堆栈,当你回到你弹出最后一个元素从堆栈中并没有什么点它了,所以不破坏只是浪费空间!

Activities in android are stored in a Stack called activity-stack, when you go to next Activity it's added to the stack, when you go back you pop last element from stack and nothing points at it any more, so not destroying is just waste of space!

即使你覆盖后退按钮启动previous活性 noHistory clearTop 标志,目前活动将被销毁。

Even if you override the back button to launch previous activity with noHistory or clearTop flag, current activity would be destroyed.

我建议你阅读更多关于活动周期

I suggest that you read more on activity lifecycle

这篇关于我怎么能拒绝的活动被销毁的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆