What is Intent in Android

Leave a Comment
Overview : 

Intents are asynchronous messages which allow Android components to request functionality from other components of the Android system. For example an Activity can send an Intents to the Android system which starts another Activity.
Therefore Intents allow to combine loosely coupled components to perform certain tasks.
Intents can be used to signal to the Android system that a certain event has occurred. Other components in Android can register to this event and will get notified.
Intents are instances of the android.content.Intent class.
Intents are send to the Android system. Depending on how the Intent was constructed the Android system will run an receiver determination and determine what to do.
An Intent can also contain data. This data can be used by the receiving component. For example your application can calls via an Intent a browser component. As data it may send the URL to the browser component.
Android supports explicit and implicit Intents.

Explicit Intent : 
Explicit Intents explicitly names the component which should be called by the Android system, by using the Java class as identifier.
The following shows an explicit Intent. If that Intent is correctly send to the Android system, it will start the associated class.
Intent i = new Intent(this, Next.class);
i.putExtra("Value1", "This value one for Next ");
i.putExtra("Value2", "This value two Next"); 
Explicit Intents are typically used within on application as the classes in an application are controlled by the application developer.

 Implicit Intent :
 Implicit  Intents do not directly specify the Android components which should be    called.They specify the action which should be performed and optionally an URI which should be used for this action.

0 comments:

Post a Comment