Uraz Pokharel
Uraz Pokharel

Reputation: 210

How to start another installed app in Android from my application?

Hello guys I am new to android core apps but I love to do animation stuffs in Android. But what I want is I want to start another another app using my application. For eg. I want to start facebook app using my application. I dont know if the question is understood or not, but really need a clue on how to do such stuffs. Thank you!!

Upvotes: 1

Views: 68

Answers (2)

KerlW
KerlW

Reputation: 381

check android's developer document about: Intent

refer to Context: startActivity startService sendBroadcast

Upvotes: 0

agustinaliagac
agustinaliagac

Reputation: 849

Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
startActivity(launchIntent);

In your case, you should check this apps package names and replace them.

It wouldn't be a bad idea to check if it's installed first :

private boolean isPackageInstalled(String packagename, Context context) {
    PackageManager pm = context.getPackageManager();
    try {
        pm.getPackageInfo(packagename, PackageManager.GET_ACTIVITIES);
        return true;
    } catch (NameNotFoundException e) {
        return false;
    }
}

Upvotes: 1

Related Questions