I have a Android application that requires a splash screen. I have a simple activity which shows the splash screen and after a number of seconds, it starts the 'main' activity. Now, when a user presses t开发者_StackOverflow中文版he back button from that activity, the splash screen shows again. How can I prevent this? I tried keeping a boolean shownSplash and this partially works, but when the app is running and the user wants to open it from the app-launcher, the app exits (since splash calls finish() when splashShown is true). Any ideas?
Thanks, Erik
Set android:noHistory="true"
to the activity entry at the AndroidManifest.xml. That will prevent the activity from being saved on the stack.
精彩评论