Pardon my dodgy explanation in the title. What happens is: I'm trying to make a home screen application. So far so good, I made the app launcher that launches an application when executed. But, if for example I press the home screen to be taken back to my application, instead of continuing the activity from onResume() it relaunches the application from onCreate();
this is the code i use to launch e new activity:
PackageManager pm=getPackageManager();
Intent intent = pm.getLaunchIntentForPackage(applications.get(c).pname);
startActivity(intent);
Any idea how I can make it so that when I press the Home button it doesn't relaunch the whole app?
在活动上设置android:launchMode="singleInstance"
属性。
@femi
thanks your answer was really great, it was exactly what i was looking for :)
<application
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:allowTaskReparenting="true"
android:launchMode="singleInstance">
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.