How can I open another layout xml file when I click on a button in main.xml file?
so if I have main.xml which has a button sying click here and I click it, it opens
A Kotlin way:
-Add the onClick event directly in the designer.
-Open the Activity .kt file
Add the function with the name that you just defined in the designer
fun openActivity2(view: View) {
intent = Intent(view.context,Activity2::class.java)
startActivity(intent)
}
Now you have the function linked to the onClick event of your button