Android starts the activity implementation code in another app / APK
Android starts the activity implementation code in another app / APK
preface:
Android provides the ability to start an activity in another app in one app, which makes it easy for our program to call the functions of other programs, thus enriching the functions of our app. For example, if you send a location information in wechat, the other party can click the location information to start Tencent map and navigate. This scene plays a great role in reality, especially when friends can't find each other in a strange environment, this function is simply a savior.
Originally, I wanted to call the name of this article "starting an activity in another process". I think this is a force. Because each app will run in its own virtual machine, and each virtual machine runs in a process. But when you think about it, it can be called a process on the premise that the app must run. Android provides the ability to start its specific activity without starting another app.
We have at least two ways to start an activity in another app,
The first one starts with action. For details, see my previous article "activity to start another program".
The second method is to start by setting classname or component with intent.
Examples are as follows. Create two new projects, projecta and projectb, and start the mainactivity of a with the mainactivity in B. The key codes are as follows:
ProjectB MainActivity
ProjectA MainActivity
Thank you for reading, hope to help you, thank you for your support to this site!