Hi I made a modification in my app which is I want to close my app after clicking the back button. This might sound common right? but this is what exactly happens to my app. I have 3 screens: Start Page, Game Page and Score Page. after pressing the start button from the Start page it will start the Game Page Intent. After finishing the game the Game Page will then move the intent into Score Page and when the back button is pressed from the Score Page, the intent will be passed on the Start Page like this:
- Start Page -> Game Page
- Game Page -> Score Page
- Score Page (when back button is pressed) -> Start Page
Now after I go back to the Start Page when I pressed the back button again instead of exiting the app it will just go back to the Score Page and again If I pressed the back button it will go to the Start Page again making an endless loop. I placed this code to my Start Page but it doesn't solve my problem:
@Override
public void onBackPressed() {
Startup.this.finish();
}
Do I need to change the flow of my intents or there is a possible solution for this one?