startActivity始终在呼唤的onDestroy在原活动 [英] startActivity is always calling onDestroy on the original activity

查看:324
本文介绍了startActivity始终在呼唤的onDestroy在原活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当从我的活动调用startActivity(意向意图)的onDestroy()方法总是被调用就可以了,所以我失去了我的片段状态,等等...

When calling startActivity(Intent intent) from my activity, onDestroy() method is always being called on it, so I lose my state of fragments, etc...

我的理解是应该的onStop被调用,可能的onDestroy或无法调用。但我的经验是,原来的活动总是被破坏。

My understanding is that onStop should be called, and onDestroy could or could not be called. But my experience is that the original activity is always being destroyed.

我明白,如果我有一个ListView活动,通过一个适配器,等等Android不指望我只是SVE适配器的状态,因为我推在这一个顶部另一个活动,对不对?

I understand that if I have an activity with a listView, with an adapter, etc... Android does not expect me to sve the state of the adapter simply because I push another activity on top of this one, right?

我是正确的?有什么能引发这种行为?

Am I correct? What could be triggering this behavior?

感谢您

推荐答案

在某些设备(银河S2等),则这可能会导致活动被破坏,而调试设置。你可以找到这个在:

On some devices (Galaxy S2 etc.), there is a setting which can cause activities to be destroyed whilst debugging. You can find this in:

settings > developer options > go down to the bottom under apps section > 

不保留活动

取消选中此选项,当你离开他们停止总是被销毁活动。

Uncheck this option, to stop activities always being destroyed when you leave them.

这篇关于startActivity始终在呼唤的onDestroy在原活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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