I build an app. There are so many activities. When clicked on the back button of the phone it supposed to exit from the app when in the `MainActivity` but when clicked on back button it switches between the activities visited recently. I added Intents to switch to the activity I need to switch for every activity except `MainActivity`. Now they are working perfectly but I need my app to exit when clicked on the back button of the phone when in the `MainActivity` and also one thing, I have an **Splash Activity** in my app. I made some apps earlier also and there were one `WebView` app and there are only one Activity. In that app also there were a **Splash Activity** and when clicked on the back button it goes to the splash activity and not exiting the app. Also I need to exit the app when clicked on the button.
Please help me!
God Bless!
CodePudding user response:
This can be achieved using finishAffinity()