i started creating a Android App with Android Studio. I created a button (and added android:onClick="page2") in the MainActivity that links to a second Activity with the following code in the MainActivity.java:
public void page2 (View view) {
setContentView(R.layout.activity_page2);
}
So far that works well and i can change from the MainActivity to the page2 Activity. Now i tried to create a Button on page 2 to link back to the MainActivity, but when i start the emulator and click the button the app crashes..
Any suggestions what the problem is? Maybe i have to restart the MainActivity before i can switch back to it?
Thanks for the help :)