to open a new activity in Android, needless to say, Intent,intent is definitely used as one of the four components of Android, and it is understood that intent is used to communicate between (three different components), usually open One activity is to use
Intent.setclass (thisactivity. this, targetactivity. class ) or do not use the above method, you can open the next activity through a configuration file first change the SetClass method to intent.setaction ("com.accp.targetactivity" ), and modify the configuration file <activity android:name= ". Targetactivity "> <intent-filter> <action android:name=" com.accp.targetactivity "/> <category android:name= "Android.intent.category.DEFAULT"/> </intent-filter></activity>
The Action,category property of intent is a normal string in which the action represents an abstract "action" to be done by the intent, while the category is used to add additional category information to the action. The Action property is typically used in conjunction with the Category property.
In the end, which activity will the program start? Depends on the configuration of the elements in the activity configuration. <activity.../> 's <Intent-filter.../> sub-elements are used to configure the Intent that the activity responds to.
Here we know that our own project will have a main activity, the main activity equivalent to the main function in C #, is the entire application of the storage, then how the main activity is started? Is it intent? With this question I found some information on the internet, of which Luo Shenyang's blog dedicated to the introduction of the "Android application launch process source code Analysis" This blog detailed how the application is launched, of course, I suspect that the main activity is actually initiated by intent.
This blog post also tells us, in order to understand some things, you can start from the source code, the answer is in the source code. This is a kind of problem-solving ideas and methods.
Android Intent Personal Introduction