Home Tutorials How to jump from one activity to another activity in Kotlin

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.

Aditya Singh
Hi, I’m Aditya Singh. The Co-Founder of this blog AndroidHire. I’m Part-Time blogger, and digital marketer. If you want to contribute then you can contact us at contact@androidhire.com

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

How to Setup iCloud account on Android

In this post, I am going to tell you how to setup iCloud account on Android Device. Changing ecosystems can be tough, from Android...

Does Stadia support split screen multiplayer?

Best answer: Yes, Stadia Support split-screen multiplayer via Stream connect technology. Last week was a big one, Both for Apple and Google. Apple silently introduced...

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...

Samsung Galaxy J8 2018 price, full specification

Samsung Galaxy J8 2018 was launched in May 2018. It runs on Android 8. The price of this phone is around Rs. 18,990.00 for...