How do I programmatically launch a specific application?

You use the package name / class directly, for example to create a new intent to call the twidroid program you'd use the followinglink text:

 Intent intent = new Intent("com.twidroid.SendTweet");

You'd probably want to put a try/catch around for a ActivityNotFoundException for when the application is not installed.


You should use the function of the package manager.

Context ctx=this; // or you can replace **'this'** with your **ActivityName.this**
try {
Intent i = ctx.getPackageManager().getLaunchIntentForPackage("com.twidroid.SendTweet");
ctx.startActivity(i);
} catch (NameNotFoundException e) {
    // TODO Auto-generated catch block
}

Tags:

Android