What is the best way to launch an application from another?
I'm doing:
Intent i;
PackageManager manager = getPackageManager();
try {
i = manager.getLaunchIntentForPackage("XXX");
if (i == null)
throw new PackageManager.NameNotFoundException();
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);
and I can start the application.
My problem is that if the application is running, it must maintain state, showing the last activity, without launching the application from the beginning (SplashScreen).
If I try to start the application by clicking the "Home button" and from "Task Manager" choose my application, she goes to Foreground, keeping the state it was before going to background.
I tried using different flags without success. The settings should be doing in my application that calls or should be in the application to be started?
Thanks in advance for your help.