Skip to content Skip to sidebar Skip to footer

Call Another Appllication From My Application

I am creating an application where I need to call another application that is already installed in the device on button click. I have done some research on it and I understand tha

Solution 1:

You will need to call Implicit Intents

From the documentation:

Implicit Intents have not specified a component; instead, they must include enough information for the system to determine which of the available components is best to run for that intent.

These intents can be triggered providing any action, type or category information

For example you want to open browser Activity and you don't know the Activity class name you will use something like this:

Intentin=newIntent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com"));
startActivity(in);

Another example: you don't know the Gallery Activity class, you will call it using Implicit Intent like this:

Intentintent=newIntent();
intent.setType("image/*");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent,"Select Picture"), SELECT_PICTURE);

Solution 2:

Here the call Enjoy coding....

Intentres=newIntent();
    StringmPackage="com.ReachOut";
    StringmClass=".splash1";
    res.setComponent(newComponentName(mPackage,mPackage+mClass));
    startActivity(res);

Solution 3:

If the exact application is less important, and you just need something that will display your content, you can omit the component name entirely, too. Just set the action, data, and (optionally) type on the intent and let the OS do the work.

Intentintent=newIntent();
intent.setAction(Intent.ACTION_VIEW);
intent.setData(/*your data uri*/);
intent.setType(/*your data's MIME type*/);
startActivity(intent);

This intent will be handled by some app that has registered for intents with the view action and the appropriate MIME type. This is an implicit intent, like Adil mentioned.

Post a Comment for "Call Another Appllication From My Application"