An Intent is Android‘s method for relaying certain information from one Activity to another. An Intent, in simpler terms, expresses to Android your intent to do something. You can think of an Intent as a message passed between Activities. For example, assume that you have an Activity that needs to open a web browser and display a page on your Android device. Your Activity would send an ?intent to open x page in the web browser,? known as a WEB_SEARCH_ACTION Intent, to the Android Intent Resolver. The Intent Resolver parses through a list of Activities and chooses the one that would best match your Intent; in this case, the Web Browser Activity. The Intent Resolver then passes your page to the web browser and starts the Web Browser Activity. Intents are broken up into two main categories:

Activity Action Intents:- Intents used to call Activities outside of your application. Only one Activity can handle the Intent. For example, for a web browser, you need to open the Web Browser Activity to display a page.
Broadcast Intents:- Intents that are sent out for multiple Activities to handle. An example of a Broadcast Intent would be a message sent out by Android about the current battery level. Any Activity can process this Intent and react accordingly—for example, cancel an Activity if the battery level is below a certain point. The current Activity Action Intents that are available to you. As you‘ll notice, in most cases, the name of the Intent does a good job of describing what that Intent does.

Inclined to build a profession as Android Developer? Then here is the blog post on Android Training ONLINE.

Intents are used for navigation purpose in android that means pass the control from one activity(class) to another activity(class). In three application components we are using this intent mechanism (Activity, Service, Receiver) but not for Content Provider. Intents are of two types.

They are :

  • Implicit Intents
  • Explicit Intents.

Explicit Intents

Android Explicit intent specifies the component to be invoked from activity. In other words, we can call another activity in android by explicit intent.

We can also pass the information from one activity to another using explicit intent.

Passing the control from one Activity to another Activity:

By using two methods we can do navigation from one activity to another activity. They are:

  1. startActivity(Intent intent)
  2. startActivityForResult(Intent intent , int requestCode).

Frequently asked Android Interview Questions

startActivity() :

Subscribe to our youtube channel to get new updates..!

This method is from context class and it supports only for single direction communication.

Intent intent = new Intent(context c,class);


Ex: If I want to pass the control from A(activity) to B(activity) at that time, we write this logic in A activity.

Coding:- Intent intent = new Intent(A.this,B.Class);



This method is from Activity class and it supports only for bi-direction communication. Here three steps will be involved as follows.

Step – I:  In class A, we write this code .

        Intent intent = new Intent(A.this,B.class);

Step – II: In class B,we need to call the setResult() from Activity. We write this logic.

setResult(int ResultCode, Intent intent);

Logic :

Intent data = getIntent();
String result = F + S;

Step – III: Again in A class we have to call callback method onActivityResult (int requestcode, int resultCode, intent data). Here, automatically the request code and result code will be bonded to this variables.


protected void onActivityResult(int requestCode,int resultCode, Intent data) { if (requestCode == 100 && resultCode == 1001) {
String total = data.getStringExtra("result"); Result.setText(total);

Implicit Intents

Implicit Intent doesn’t specify the component. In such case, intent provides information of available components provided by the system that is to be invoked.

If we want to interact with default software components and hardware components, at that time we use this type of intents.

For Opening Browser:-

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(""));

For opening calling screen:-

Intent intent = new Intent(Intent.ACTION_CALL,Uri.parse("tel:9493577797")); startActivity(intent);

For opening Dialing screen:-

Intent intent = new Intent(Intent.ACTION_DIAL,Uri.parse("tel:9493577797")); startActivity(intent);

For opening contacts:-

Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse("content://contacts/people/1"));

For opening Camera:-

Intent intent = new Intent(""); startActivityForResult(intent, 0);
Explore Android Sample Resumes! Download & Edit, Get Noticed by Top Employers!Download Now!