sWhat is an intent?
We use an intent in Android for commencing a new activity. They are used extensively for carrying specific information regarding the activity which has to be started. In fact, by making use of the intents, it will be possible for us to interact with various components from the same applications along with components which have been provided by other applications. For instance, an external activity for taking a photograph can be initiated by a particular activity. We can also use intents for delivering a broadcast and also for commencing a new service.
How many different intent types in android?
There are 2 types of intents in Android, namely, Explicit intents and Implicit intents. In the subsequent paragraphs, we are going to throw some light on both these types of intents.
1. Explicit intents
An explicit intent can be used to start a component in the application. The component is specified by this particular type of intents to start by name, which means that it is mandatory to call the fully qualified class name. It is easy to comprehend this as the fact that we are responsible for developing our own apps and the service which we would like to start as well as the name of the activity is already known to us. For instance, start a new service for downloading a file in the background or start a fresh activity in response to the action of a specific user.
2. Implicit intents
Instead of specifying the name of the component, these types of intents actually declare a general action to be performed so that it can be handled by another component from some other application. For instance, in order to show a particular location to the user, implicit intent can be used to request that a particular location on the map is shown by another competent application.