I need only one instance of my app in android. If I run my app after installation and go to Home screen, and again run my app (click on app's icon), second instance is opened, I need to open already running first instance not to run second instance. I don't know how to solve this.
在android中,我只需要一个应用的实例。如果我在安装后运行我的app,回到主界面,再次运行我的app(点击app的图标),第二个实例被打开,我需要打开已经运行的第一个实例而不是第二个实例。我不知道怎么解这个。
1 个解决方案
#1
18
Use android:launchMode="singleTask"
or android:launchMode="singleInstance"
in your manifest.xml in your activity
tag
使用android:launchMode=“singleTask”或android:launchMode=“singleInstance”。活动标记中的xml
#1
18
Use android:launchMode="singleTask"
or android:launchMode="singleInstance"
in your manifest.xml in your activity
tag
使用android:launchMode=“singleTask”或android:launchMode=“singleInstance”。活动标记中的xml