Types of Intent in Android

Intent is of two types:

  1. Implicit Intent
  2. Explicit Intent

Implicit Intent

The implicit intent is the intent where instead of defining the exact components, you define the action that you want to perform for different activities.

An Implicit intent specifies an action that can invoke any app on the device to be able to perform an action. Using an Implicit Intent is useful when your app cannot perform the action but other apps probably can and you’d like the user to pick which app to use.

Syntax:

Intent i=new Intent();
i.setAction(Intent.ACTION_SEND);

There are some other standard actions that intents can use for launching activities.

Explicit Intent

An explicit intent is an Intent where you explicitly define the component that needs to be called by the Android System. An explicit intent is one that you can use to launch a specific app component, such as a particular activity or service in your app.

Syntax:

Intent I = new Intent(getApplicationContext(),NextActivity.class);
I.putExtra(“value1” , “This value for Next Activity”);
I.putExtra(“value2” , “This value for Next Activity”);