Android's basic design philosophy is to encourage the reduction of coupling between components, so Android provides Intent (intent), Intent provides a generic messaging system that allows you to pass Intent between your application and its other applications to perform actions and generate events. Use Intent to activate three core components of the Android app: activity, service, and broadcast receiver (Broadcastreceiver).
Intentions :
Explicit Intent : Calling the Intent.setcomponent () or intent.setclassname () or Intent.setclass () method explicitly specifies the Intent of the component name as an explicit intent, Explicit intent explicitly specifies which component the intent should be passed to.
Intent Intent = new Intent ();
1. Intent.setcomponent (New ComponentName (Mainactivity.this, Otheractivity.class));
2. Intent.setclass (Mainactivity.this, Otheractivity.class);
3. Intent Intent = new Intent (mainactivity.this,otheractivity.class);
Implicit Intent : Intent with no explicitly specified component name is implicitly intended. The Android system finds the most appropriate component to handle this intent based on the action (action), category, data (Data:uri, and data type) set in the implicit intent.
Uri data = Uri.parse ("Tel:" + phonecode);
Intent Intent = new Intent (intent.action_call, data);
Get intent using the Getintent () method, get the action using intent.getaction (), Get Data using Intent.getdata () in the oncreate of the ativity that is started.
intent to start :
Start the intent not to return results, using startactivity (intent).
Start the intent to return the result, using Startactivityforresult (Intent, show_subactivity), show_subactivity is the request code used to receive the callback result in the Onactivityresult ( int requestcode, int resultcode, Intent data) method to distinguish the callback of an open child activity.
To pass a component that is responsible for the second best bet, use Startnextmatchingactivity (intent) after getting intent in oncreate.
Intent Filter :
If the intent filter contains the specified action, or if no action is specified, then the action is considered to match.
The intent filter must contain all the category in the intent to be parsed, and the intent filter without the specified category can only match the intention of no category. It is important to note that Android treats all the implicit intentions passed to startactivity () as if they contain at least one category: "Android.intent.category.DEFAULT" (Category_default constant).
Each part of the intended data URI is compared with the data label of the intent filter, and the intent filter without the specified data value will match all intent data values.
static string constants in the intent class
Action
Action_answer open an activity to process incoming calls
Action_call open a phone dialer and immediately dial a phone with the number provided by the intent URI
Action_delete initiates an activity that allows the deletion of the data specified in the intent URI
Action_dial open a dialer that dials the number provided by the intent URI
Action_edit request can edit the specified intent URI of the data in the activity
Action_insert opens an activity that can insert a new entry in the cursor specified by the intent URI
Action_pick initiates a child activity that allows you to select an entry from the content provider specified by the intent URI
Action_search launching activities for performing a search
Action_sendto initiates an activity to send a message to the contact specified by the intent URI
Action_send initiates an activity that sends the data specified in the intent
Action_view general action to process view requests based on the URI pattern of the data provided
Action_web_search performing a WEB search based on text provided by the intent URI
Category
Alternative an option to specify the action as the default action performed on a specific data type
Selected_alernative using actions to help fill the context menu
browsable actions available inside the browser
Default causes a component to act as an action for the specified data type in the intent filter
GADGET activity can be embedded in another activity to execute
When home does not specify an action, the intent is as an option for the local home screen
LAUNCHER appears in the initiator of the application
android-Intent Intent