Suppose I am in App1 and I want to open another app from my phone, App2, starting it with one of it's activities, SecondActivity. I need to do this with any of the apps that I have on my phone, so if I install new ones I need to be able to start them with any of their activity. I found this answer really useful, except from the fact that the activity I want to start with is declared in the manifest. If I have 10 installed apps with 10 activities each this solution doesn't help me at all.
Asked
Active
Viewed 229 times
1 Answers
1
Intent intent = new Intent();
intent.setClassName("app2.package.name", "app2.fully.qualified.activity.name");
startActivity(intent);
This works without having to do anyhing to the manifest in either your app or the target app. You might want to set the flag Intent.FLAG_ACTIVITY_NEW_TASK
if you want to launch the app in a task of its own (and not within your app's task).

David Wasser
- 93,459
- 16
- 209
- 274