[英]Android - A way to trigger onRetainNonConfigurationInstance?
Is there a way to trigger the calling of onRetainNonConfigurationInstance on my activity, so getLastNonConfigurationInstance() returns something the next time the activity is created? 有没有一种方法可以触发对我的活动的onRetainNonConfigurationInstance的调用,因此getLastNonConfigurationInstance()在下次创建该活动时会返回一些信息?
I ask because I have a memory leak in my application which only appears/crashes my app after my phone is left idle for hours, so I believe the issue is here. 我问是因为我的应用程序中存在内存泄漏,该问题仅在手机闲置数小时后才会出现/崩溃,因此我认为问题出在这里。
Force Stop in Settings does not cause this. 在设置中强制停止不会导致此情况。 Any help would be greatly appreciated as i've spent days chasing red herrings to catch this bug. 由于我花了几天时间追赶红鲱鱼来捕获此错误,因此将不胜感激。
如果您遇到内存泄漏,建议您管理这些内存泄漏,而不是强制旋转屏幕。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.