views:

67

answers:

2

Hi,

I want to launch an installed package from my Android application. I assume that it is possible using intents, but I didn't find a way of doing it. Does anyone have a link, where to find the information?

Thanks

A: 

If you know the data and the action the installed package react on, you simply should add these information to your intent instance before starting it.

If you have access to the AndroidManifest of the other app, you can see all needed information there.

WarrenFaith
Thanks for the reply. Yes I have the AndroidManifest of the other application. What I try to do now is the following code: Intent intent = new Intent(Intent.ACTION_MAIN);intent.setComponent(new ComponentName("com.package",".MainActivity")); startActivity(intent); but in this way it is not working. Can you give me a more precise link, how to do it?
Bastian
What is the error message you have in your LogCat?
WarrenFaith
The application crashes at the line "startActivity...": The application has stopped unexpectedly. Pleas try again. Where can I see the error in LogCat?
Bastian
I found the error: When setting the component, the fully qualified class name instead of just the class has to be named: intent.setComponent(new ComponentName("com.package","com.package.MainActivity")) instead of intent.setComponent(new ComponentName("com.package",".MainActivity"))
Bastian
Good to know... You can find the LogCat on eclipse: Window > Show view > Other, Android > Logcat
WarrenFaith
A: 

I found the solution. In the manifest file of the application I found the package name: com.package.address and the name of the main activity which I want to launch: MainActivity The following code starts this application:

Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
startActivity(intent);
Bastian