Android USES Intent to start other non system applications
- 2020-11-25 07:32:36
- OfStack
This article illustrated how Android USES Intent to launch other non-system applications. To share for your reference, the details are as follows:
Within the android application, the jump between Activity is realized through Intent. Also known to call system programs through Intent. But if you want to start application B in application A (assuming both A and B are installed), how do you do that?
Document the implementation.
Add the following code to the application A:
Intent i = new Intent();
i.setClassName("com.example.a", "com.example.a.AActivity");
startActivity(i);
or
Intent i = new Intent();
ComponentName cn = new ComponentName("com.example.b", "com.example.b.BActivity");
i.setComponent(cn);
startActivity(i);
Note:
com.example.a is the package name for the application B
com. example. a AActivity is application B Activtiy you are about to start
So that's OK.
I hope this article has been helpful in Android programming.