I am trying to make a text-based choice game for Android, very similar to the game called "Magium"
https://play.google.com/store/apps/details?id=com.magiumgames.magium&hl=en
Users will choose from a few options by pressing respective buttons to progress the story. After a buttons press, I want the app to show another layout. Let's say there is only one button (named button1) in page1. Pressing it changes the layout to page2. I achieved this by:
button1.setOnClickListener {
setContentView(R.layout.page2)
}
Again, for simplicity, let's say there is only one button (named button2) in page2. I want to show page3 after user presses button2.
I added the same code below the previous code as:
button1.setOnClickListener {
setContentView(R.layout.page2)
}
button2.setOnClickListener {
setContentView(R.layout.page3)
}
However, the app doesn't open when I do this. I am just beginning to learn programming. Could someone point me in the right direction?