本文介绍了在活动的onPause调用完成方向改变过程中崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要preserve资源和prevent内存泄漏,我打电话完成()在活动的onPause每当应用程序是从一个活动到另一个。我觉得它工作正常,但是当我尝试旋转屏幕,应用程序崩溃 - 错误是重复结束请求
我怎样才能prevent这一点,是在有活动的onPause的方式,如果应用程序是要到下一个活动或只是改变方向来检测?
是否有那么preserving内存采用光洁度更好的方法?

To preserve resources and prevent memory leaks, I am calling finish() in onPause event whenever app is going from one activity to another. I think it works fine, but when i try to rotate screen, app is crashing - error is "Duplicate finish request"How I can prevent this, is there way in onPause event to detect if app is going to the next activity or just changing orientation?Is there better method for preserving memory then using finish?

感谢您的帮助!

推荐答案

只是一个镜头在这里的黑暗,但你在你的onPause实现调用super.onPause()?

Just a shot in the dark here, but are you calling super.onPause() in your onPause implementation?

这篇关于在活动的onPause调用完成方向改变过程中崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-16 17:17