开发者

Is there a way to differentiate between normal Activity destruction and one caused by rotation?

I have an Activity that start some asynctasks. I want these tasks to stop, when my Activity is destroyed "normally" (like calling finish() / the user pressing the back button / etc.), but continue running when the user only rotates the device.

Canceling these tasks, and handling the rotation works just fine, I just can't combine the two.

So is there a way to tell during the "onDestroy()" callback, that the Activity is destroyed bec开发者_StackOverflowause of a configurational change (rotation), or because of some other cause (back button e.g.)?


You can call isChangingConfigurations() on your Activity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜