0

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.

Ruli
  • 2,592
  • 12
  • 30
  • 40
oli
  • 63
  • 1
  • 8

2 Answers2

2

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

Community
  • 1
  • 1
daltoniam
  • 579
  • 7
  • 13
0

Set clearTaskOnLaunch via the Android Manifest of your project to true. This will clear the task/stack history whenever the activity is launched.

Austin Hanson
  • 21,820
  • 6
  • 35
  • 41
  • Where a bouts do I put this in the Android Manifest file? – oli Aug 08 '11 at 09:53
  • Double click "AndroidManifest.xml" in your package explorer on the left, then click on the Application tab at the bottom, select the activity and scroll through the right side to find the option. – Austin Hanson Aug 08 '11 at 12:26