In an Android application, it's made up of four components, and these four components refer to the "Android apps". And these four components are independent, they can call each other, coordinate their work, and eventually make up a real Android application.
The communication between these components is mainly done by intent assistance.
Intent is responsible for the operation of the application of the action, action involved in data, additional data description, Android according to this intent description, responsible for finding the corresponding components, the intent passed to the calling component, and complete the component calls.
Therefore, intent plays a role as a media intermediary, which provides information about the invocation of components to each other, and realizes the decoupling between the caller and the callee.
For example, in a contact maintenance application, when we click on a contact in a contact List screen (assuming the corresponding activity is listactivity), we want to be able to jump out of the contact's details screen (assuming the corresponding Activity for Detailactivity)
To do this, listactivity needs to construct a Intent that Intent to tell the system that we want to do a "view" action that corresponds to the viewing object "a contact" and then calls StartActivity (Intent Intent). The constructed intent is passed in, the system will find the activity that satisfies this intent requirement in the manifest according to the description in this intent, the system will call the activity found, that is detailactivity, the final incoming intent, Detailactivity performs the appropriate action according to the description in this intent.
What is an abstract description to describe?
In the Android reference document, the definition of intent is an abstract description (indeed abstract) that performs an operation. Let's take a look at the abstract description here, what exactly is described here.
First, a brief description of the action to be performed, such as view_action (view), edit_action (Modify), and so on, Android defines a set of standard actions for us:
MAIN_ACTION
VIEW_ACTION
EDIT_ACTION
PICK_ACTION
GET_CONTENT_ACTION
DIAL_ACTION
CALL_ACTION
SENDTO_ACTION
ANSWER_ACTION
INSERT_ACTION
DELETE_ACTION
RUN_ACTION
LOGIN_ACTION
CLEAR_CREDENTIALS_ACTION
SYNC_ACTION
PICK_ACTIVITY_ACTION
WEB_SEARCH_ACTION
In addition, we can define our own actions according to the needs of the application and define the corresponding activity to handle our custom actions.
Second, it is the data that executes the action, and the android is represented by a URI that points to the data, as in a contact application, a URI to a contact may be: CONTENT://CONTACTS/1.
This URI representation, by Contenturi this class to describe, you can refer to the Android.net.ContentURI class documentation.