Intent and intent filter
what is Intent?
Communication between application component such as Actvity,Service,BroadcastReceiver and ContentProvider.
Types Of Intent
Explict Intent which is called Communication between application component such as Actvity,Service,BroadcastReceiver and ContentProvider
Example used on starting activity
Intent in =new Intent(Mainclass.this,Mainclass2.class);
startActivity(in);
Implict Intent based on specific action we can invoke other apps in our system.For example if your apps is not having capable to access certain operation then other app is capable to do that mean we can call that app using implict intent.
Scenario 1 if you want to share information to other user then you can use ACTION_SEND and pass content inside Extra through intent it will show list of app capable to share the information where the user can select specify app
Intent in =new Intent();
in.setAction(Intent.ACTION_SEND);
in.putExtra("msg","Hi friend how are you");
startActivity(in);
what is IntentFilter?
specify the type of intent that component would like to receive.If you declare a intentfilter inside a activity then you make other apps to startActivity by specific intent.
Components of intentfilter
action: specify the action need to be carried out.
Category: Based on the action which category need to be displayed for example sending message then data transfer application alone will be categorized.
data: specify the data type either text,video or image etc
we can also declare our own intent filter so it will be accessed by other application
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="text"></data>
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>