Search code examples
androidsplash-screen

Android: Splash screen issues


On my Android App, I have set up a splash screen. The splash screen opens when the app is opened and lasts for two seconds before it redirects to a login screen.

The issue I am having is that the splash screen displays once, and then re-directs to the login screen. BUT when I click on the app again it goes straight to the login screen ignoring the splash screen. Is there a reason for this? Does it automatically open on your last screen? Because then if I hit the back button when it opens on the login screen it DOES go back to the splash screen but then doesn't redirect to the login screen after 2 seconds.


Solution

  • Yes this is normal behavior. When you hit the back button after the second launch you are ending the app, thus your splash screen shows on the next launch. You will need to add an intent to your login activity's on resume method to launch your splash screen. Here is a on resume example. Android example which uses onResume, onStart and onRestart