Skip to content

Instantly share code, notes, and snippets.

@mikkipastel
Created September 21, 2022 11:15
Show Gist options
  • Save mikkipastel/172fa4d6a3e55e559e58717c42165a84 to your computer and use it in GitHub Desktop.
Save mikkipastel/172fa4d6a3e55e559e58717c42165a84 to your computer and use it in GitHub Desktop.
start second activity by intent
package com.ascedncorp.androidbasic
import android.content.Intent
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.ascedncorp.androidbasic.databinding.ActivityMainBinding
class MainActivity: AppCompatActivity() {
private val binding: ActivityMainBinding by lazy {
ActivityMainBinding.inflate(layoutInflater)
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(binding.root)
binding.button.setOnClickListener {
val intent = Intent(this, SecondActivity::class.java)
startActivity(intent)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment