How to launch another app from your app

If you ever need to launch another app from your own it’s actually easier than you think.
The PackageManager class provides some handy methods that make this a snap.
All you need to know is the package name of the app you want to launch and then use the code below:

protected void launchApp(String packageName) {
		Intent mIntent = getPackageManager().getLaunchIntentForPackage(
		if (mIntent != null) {
			try {
			} catch (ActivityNotFoundException err) {
				Toast t = Toast.makeText(getApplicationContext(),
						R.string.app_not_found, Toast.LENGTH_SHORT);;

You can use to get the package name of individual apps by looking at the url in the browser.

If you need to automate you can get a list of installed apps like this:

final PackageManager pm = getPackageManager();

		List packages = pm

		for (ApplicationInfo packageInfo : packages) {

			Log.d(TAG, "Installed package :" + packageInfo.packageName);
					"Launch Activity :"
							+ pm.getLaunchIntentForPackage(packageInfo.packageName));


Hope this helps!

18 comments on “How to launch another app from your app”

  1. Dympy

    In your second example (for the app list), do you really have to use the tag?


  2. Pingback: Tims Blog » Blog Archive » Links and riding

  3. Dympy

    I didn’t mean that tag, I meant the tag.
    You don’t really need it.


  4. Lacra

    Hi! I’m new to android so I have a question that is kind of related to your post. I have a list of all the installed apps on my phone. I used your code so as to when click on one item in the list it launches the application. My problem is that it works for some of the apps in the list ( I mean that it launches them)…but for some it tells me that the application has stopped unexpectedly and it is forced to close and it doesn’t launch it. Some of the apps that don’t work are Calculator, Contacts, Dialer, Example Wallpapers and some of the apps that work are Browser, Search, Music, Custom Locale a.s.o. I don’t know what the problem might be and maybe you have already encountered this problem and can enlighten me, I would be grateful!

  5. Edward Granados

    @Lacra & Pranay
    look under your manifest.xml
    u need to give android permission to use those features

    there are a lot of others but i thought this would be of help

  6. Edward Granados

    uses-permission android:name=”android.permission.CALL_PHONE”
    uses-permission android:name=”android.permission.GET_TASKS”
    uses-permission android:name=”android.permission.READ_CONTACTS”
    uses-permission android:name=”android.permission.SET_WALLPAPER”
    uses-permission android:name=”android.permission.INTERNET”
    uses-permission android:name=”android.permission.EXPAND_STATUS_BAR”

  7. Nadia

    In the first code, nothing happens when i run it?

  8. PCC

    Hi all, my prob: I have a group of apps, when I launch each app in it, a message will appear and show the list of all of the other apps. I can click any app in this list and install it (if it isn’t installed) or launch it(if it is installed). I’m new to android, so, you can give me some advices?

  9. deepa

    It is showing default apps present in your device for example: html viewer(,input device(,key chain( etc can you please help me

  10. purva

    Its giving me this error please help I am learning android and not able to figure it out
    Caused by: java.lang.ClassNotFoundException: Didn’t find class “” on path: /data/app/

  11. Nitish

    it is very helpfull thanks.
    but now i want to launch facebook and youtube like apps.
    I want to ask

    Are facebook and Youtube like app have different package names with different versions ?

  12. Chitra

    where should i exactly put this code ,should i make new .java file or in file i have to add the above code.

  13. Pingback: How to: How to get a list of installed android applications and pick one to run | SevenNet

  14. CarpeVitam

    Hi, is it possible to run an app in another app? I want to use the first app to chance the Display Mode of the other app.

  15. Pingback: How-to: How to get a list of installed android applications and pick one to run #development #programming #answer | Good Answer

Leave a Reply

Your email address will not be published. Required fields are marked *