How to jump from one activity to another activity in Kotlin

In this tutorial, we will learn how to jump from one activity to another activity in kotlin. This is the main activity we have made and there is three more activity we have created. We will use Intent().

It can be used with startActivity to launch an Activity. When you click on button or image it will jump to another activity. Below is a complete tutorial of how to jump from one activity to another activity in kotlin.

Read More: Google Login And Registration For Android Using Firebase Authentication

MainActivity.java

import android.content.Intent
import android.media.Image
import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.ImageView

class MainActivity : AppCompatActivity() {

    var photo: ImageView? = null;
    var eduButton: Button? = null;
    var wrkButton: Button? = null;


    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        photo = findViewById(R.id.profile_pic_small)

        photo?.setOnClickListener({
            var clickintent = Intent(this@MainActivity, Profilephoto::class.java)
            startActivity(clickintent)
        })


        eduButton = findViewById(R.id.education_button)

        eduButton?.setOnClickListener({
            var clickedu = Intent(this@MainActivity, Education_Profile::class.java)
            startActivity(clickedu)
        })


        wrkButton = findViewById(R.id.work_experience_button)

        wrkButton?.setOnClickListener({
            var clickwrkexp = Intent(this@MainActivity, WorkExperience::class.java)
            startActivity(clickwrkexp)
        })

    }
}

If you have any confusion or need help then ask questions through the comment section we will help you out.

Recent Articles

How to Implement Text To Speech in Android Studio

Text-to-speech (TTS) technology reads clearly digital manual - the words on computers, smartphones, and tablets. This tutorial explains how to implement text to speech in android...

[Updated] Temporarily Free Games and Apps on Google Play Store

Every week there are free games and apps on the Google Play store. Here is the list of free games and apps on the Play Store you...

OnePlus 7T vs iPhone 11 | Specs Comparison

The OnePlus 7T and iPhone 11 are the two best phones if you looking for a price of less than $1000. Both the phone...

Elon Musk unveils Tesla’s Cybertruck

Are you into gaming or love watching sci-fi movies?  What about those back to the future movies which gave us a glimpse of the...

7 Best Hiking Apps you Must Try in 2020

Having the best hiking apps always gives you an advantage if you are going for adventurous trips. These apps can track your workout and activities...

Stay on Top - Get the daily news in your inbox

Related Stories