Explicit Intent – Start Another activity example in Kotlin

Explicit Intent in Android you can use for launch a specific app component, like a particular Service, Activity or Broadcast. For example, if you want to go to one activity to another one then you can use Explicit Intent and send data putExtra("value""eyehunt Tutorial") to second activity. In this example, you will learn how to pass data one activity to another activity using kotlin language.

Explicit Intent - Start Another activity example – Kotlin

In Android, there are 2 types of Intent.

  • Implicit Intent
  • Explicit Intent


Some use case of Explicit Intent is :

  1. Start the service
  2. Launch a new activity
  3. Broadcast a message

Android Intent and Types of the Intent tutorial you can read about all basic of about


Let’s Build an App for Explicit intent in kotlin :

In this tutorial, you’ll add Button and EditText widget code to that MainActivity starts a new activity to display the message when the user taps sendMessage.

Step 1. Create a new project “Build Your First Android App in Kotlin
Step 2. Create a new Activity ” SecondActivity.kt ” class

Choose an option auto to create resource file or create my own. Add the following code in in “activity_second.xml” res layout file.

Now add code in SecondActivity.class and set resource layout file.

Step 3. Add Buttons and EditText widget in an activity_main.xml resource file

EditText for taking user input as a string and button will perform an action to pass data and start a new activity.

Step 3. Add the following code in MainActivity.class

In this code using the button, it’s very easy just pass the intent with putExtra() to the target component.


Step 4. Run the application, in emulator or On you android device
Output screenshot Android Explicit Intent example :


Explicit Intent - Start Another activity example – Kotlin output

Video Output

Download source code Android Explicit Intent example in kotlin



Note : This example (Project) is developed in Android Studio 3.1.3 . Tested on Android 9 ( Android-P), compile SDK version API 26: Android 8.0 (Oreo)



Coding in Kotlin

Bonus : 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.