I am using a Full-Screen activity in my app in android studio, and everything works fine, but when the splash screen is over (after 3000 ms), the main activity or home starts, but if I use the back button from the android phone, the display goes back to the splash screen and it stays on this splash screen (you can not go back to the main activity again)...
What code can I use to avoid this? (only show once the splash screen when the app is launched and never go back to it even if I press the back button).
Thanks in advance..
I found the answer to this. If you want to prevent the MainActivity from going back to the splash screen, you can use the next method in the Main Activity:
@Override
public void onBackPressed() {
moveTaskToBack(false);
}
This method will also prevent the user from getting out of the app if they press the back button (so they stay on the app until they press the home button or the other button).