开发者

Android: 'Splash screen' only once

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜