What is intent in Android?

The intent is a messaging object which passes between components like services, content providers, activities, etc. Normally startActivity() method is used for invoking any activity. Some of the general functions of intent are:

  1. Start service
  2. Launch Activity
  3. Display web page
  4. Display contact list
  5. Message broadcasting

Methods and their Description

Methods Description
Context.startActivity() This is to launch a new activity or get an existing activity to be action.
Context.startService() This is to start a new service or deliver instructions for an existing service.
Context.sendBroadcast() This is to deliver the message to broadcast receivers.

Intent Classification:

There are two types of intents in android

  1. Implicit Intent
  2. Explicit Intent

Implicit Intent

Using implicit Intent, components can’t be specified. An action to be performed is declared by implicit intent. Then android operating system will filter out components that will respond to the action. For Example,

 

In the above example, no component is specified, instead, an action is performed i.e. a webpage is going to be opened. As you type the name of your desired webpage and click on the ‘CLICK’ button. Your webpage is opened.

Implicit and Explicit Intents in Android with Examples

Pre-requisites:

 This article aims to tell about the Implicit and Explicit intents and how to use them in an android app.

Similar Reads

What is intent in Android?

The intent is a messaging object which passes between components like services, content providers, activities, etc. Normally startActivity() method is used for invoking any activity. Some of the general functions of intent are:...

Step by Step Implementation

Creating an Android App to Open a Webpage Using Implicit Intent...

Step by Step Implementation

...

Contact Us