how to start an activity in another module explicitly

后端 未结 4 1819
囚心锁ツ
囚心锁ツ 2021-02-02 09:46

I created an aar and i added it to my project as an module. in this module i have a HelloWorldActivity that i want to run.

my module manifest looks like this.

4条回答
  •  無奈伤痛
    2021-02-02 10:44

    first module activity launch then second module activity launch and write a line of code is perfectly fine.

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

提交回复
热议问题