Android intent Example

Through this a technology blog, we will be discussing Intent in Android devices. We will all about Android Intent .

Android Intent

An Intent is a simple message object that is used to communicate between android components such as activities, content providers, broadcast receivers and services. Intents are also used to transfer data between activities. Intents are used generally for starting a new activity using startActivity().

Why Android Intent Used For ?


  1. For Launching an Activity 
  2. To start a New Service 
  3. For Broadcasting Messages 
  4. To Display a list of contacts in ListView

Android Intent Example


Android Intent

To Open Page

Intent intent = new Intent(MainActivity.this, SecondActivity.class);
startActivity(intent);

Android Intent Example

To Open Email
Intent send_mail = new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:example@gmail.com"));
startActivity(send_mail);


To Open App
Intent launch = getPackageManager().getLaunchIntentForPackage("com.my.project");
if (launch != null) {
startActivity(launchIntent); }

Hope it help you , thanks .