Issue
My menu has a game button and a close button the close button closes the app but if I run the game and proceed to the results activity, and return to the main menu via the back button. The close button the opens the results activity.
Results Activity:
@Override
public void onBackPressed() {
startActivity(new Intent(EndGame.this, Main.class));
}
Main Menu Button Close
buttonExit.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
//Closes the APP
Main.this.finish();
}
});
Solution
Change
@Override
public void onBackPressed() {
startActivity(new Intent(EndGame.this, Main.class));
}
to:
@Override
public void onBackPressed() {
finish();
startActivity(new Intent(EndGame.this, Main.class));
}
Answered By - egfconnor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.