开发者

Open the same app instance

I have a simple, one Activity application. The problem is that, if i press the BACK button, the application is minimized, but if i try to launch it again, another instance is started. I know this because my app has plays开发者_如何学JAVA a sound stream even if is minimized.

How can i maximize the already running instance when trying to launch it ?

I've tried with the code below, but is not working.

android:launchMode="singleInstance"


Android handles this for you. What is probably happening is you're replicating your objects in onCreate thus the "appearance" of 2 activities via a 2nd sound stream.


I don't know what is the C button ? If it is the "back key" so your application is unload from the system, when you start it again, it opens a new instance. If you press the 'middle key', normally there is only 3 keys on a Android phone, your application is just paused and put in the background, and when you launch it again, the sytem just put your running application from the background to the foreground. No new instance is opened. There are the methods onPause() and onResume() which are triggered in this case. Hope it can answer to your question

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜