Intent :
Intent is a way of telling to Android to perform a desired action. One components wants to invoke another to do a particular job, Any other components that are exists and it can handle through Intent-Filters by invoking Android platform to accomplish the job. This means components are not aware of each other's existence and still work together to give the desired result for the end user.
Basically Intents are two types:
1. Explicit Intent : This is used to call specific component. When you know which component you want to launch and you do not want to give the user free control over which component to use. For example, you have an application that has 2 activities. Activity A and activity B. You want to launch activity B from activity A. In this case you define an explicit intent targeting activity B and then use it to directly call it. See the below example :
startActivity(new Intent(this, ActvityB.class));
// ActivityB should be added in manifest file with in application tag.
<activity android:name=".ActivityB"/>
2. Implicit Intent:
This is used when you have idea of what you want to do ,but you do not know which component should be launched. These Intents are send to the Android system, it searches for all components which are registered for the specific action and the data type.
Example:
final String action = Intent.ACTION_VIEW;
final Intent implicit = new Intent(action);
implicit.setData(Uri.parse("http://www.google.com/"));
startActivity(implicit);
Intent Filters:
If an Intents is send to the Android system, it will determine suitable applications for this Intents. If several components have been registered for this type of Intents, Android offers the user the choice to open one of them. An Intents is send to the Android system, it will determine suitable applications for this Intents. If several components have been registered for this type of Intents, Android offers the user the choice to open one of them
Intent Filter has action, data, category etc. Please check this more info
If an Intents is send to the Android system, it will determine suitable applications for this Intents. If several components have been registered for this type of Intents, Android offers the user the choice to open one of them. An Intents is send to the Android system, it will determine suitable applications for this Intents. If several components have been registered for this type of Intents, Android offers the user the choice to open one of them
Intent Filter has action, data, category etc. Please check this more info
useful info ramesh
ReplyDelete