How to launch an Activity from another Application in Android

后端 未结 12 1451
春和景丽
春和景丽 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:24

    I found the solution. In the manifest file of the application I found the package name: com.package.address and the name of the main activity which I want to launch: MainActivity The following code starts this application:

    Intent intent = new Intent(Intent.ACTION_MAIN);
    intent.setComponent(new ComponentName("com.package.address","com.package.address.MainActivity"));
    startActivity(intent);
    

提交回复
热议问题