Implicit Extent and Explicit Intent


Intents can be classified into two different types, Implicit Extent, and Explicit Intent

Implicit Intent

Intent can be classified as implicit when an activity is initiated without the knowledge of the activity or app that is going to handle the task. Let us have a look at one of the examples. For example, the map shows the location on different apps, it can be by WhatsApp or can be by Facebook, or maybe by a food delivery app.

It doesn’t know which app is going to show the location and access the map activity. At the same time, the activity needs to let know to the other apps that it is available for implicit intent. For this, the activity needs to declare the intent filers in the file AndroidManifest.xml. This will automatically advertise the availability of the activity for the implicit intents. The file will also mention the kind of intents that will be accepted by the activity.

The Android system makes a quick match with the implicit intent, and the intent filter of an activity, whenever the apps request the activity. This is a confirmation, that the activity can be invoked by the respective application. In case multiple matches Found, that user has the option to use the app chooser which allows the user to select the app for performing the activity or handling the specific intent.
The following code demonstrates an intent for viewing the webpage.

Implicit Extent

In case of explicit, the component is specified by Android that can be invoked from an activity. This is just the opposite of what implicit intent does. Apart from this, if we need to pass certain information from one specific activity to another activity, then we have to do it through explicit intent. Because the content is specified and known beforehand, the external class needs to be invoked accordingly. Here is a sample code, which calls one activity from a different activity explicitly.