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

Samsung Galaxy S20+ leaked, image surface online

Just a few days beofre Samsung is going to showcase the new S20 series, Galaxy S20+ leaked images online somehow showing the...

Samsung Galaxy Note 10 lite: 2 Year old processor smartphone, Best Mid ranger?

Earlier this week Samsung unveiled Samsung Note 10 lite and Samsung Galaxy S10 lite. It was very surprising as Galaxy lineup has...

Easy Trick: How to Merge Finder windows in Mac

If you have used old MAC OS then you might remember you can't merge the windows and it was very difficult to work...

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

Pixel 4a renders show off hole-punch display, fingerprint sensor and 3.5mm jack, All best things togethor?

We all know that the Pixel lineups faced a lot of critism this year. MKBHD also rated Pixel 4 as the bust...

Stay on Top - Get the daily news in your inbox

Related Stories