How to launch an Activity from another Application in Android

后端 未结 12 1423
春和景丽
春和景丽 2020-11-21 06:02

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. Is there a link, where t

12条回答
  •  迷失自我
    2020-11-21 06:31

    If you don't know the main activity, then the package name can be used to launch the application.

    Intent launchIntent = getPackageManager().getLaunchIntentForPackage("com.package.address");
    if (launchIntent != null) { 
        startActivity(launchIntent);//null pointer check in case package name was not found
    }
    

提交回复
热议问题