开发者

Stopping Multiple Instances on Rotate

开发者 https://www.devze.com 2023-03-21 12:03 出处:网络
I have an application that is running and doing some web services in the background. When I rotate the screen I get a new instance of the application running.This is not the behavior that I want.

I have an application that is running and doing some web services in the background.

When I rotate the screen I get a new instance of the application running. This is not the behavior that I want.

I know that in the onSaveInstanceState I can store a flag in the bundle and then look at the flag in the onCreate to see if a previous instance is running.

But I don't know what to do then to bring my ol开发者_JAVA百科d application in focus; back to the active app.

Help would be appreciated.


Add this in your manifest for the activity

 android:configChanges="orientation"

This should ideally take care of it. You can also specify this to be a singleInstance application.

0

精彩评论

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