I have created 2 Activities in Kotlin other than main activity (total 3 activity,
1.activity _Main, 2. activity _A, 3. activity _B).... now I want to make something that when button A is clicked than activity_A is open and when button B is clicked than activity_B is open.
class activity_Main : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_Main)
/*------------------------------------*/
buttonA.setOnClickListener {
startActivity(Intent(this, ActivityA::class.java))
}
/*------------------------------------*/
buttonB.setOnClickListener {
startActivity(Intent(this, ActivityB::class.java))
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.