简体   繁体   中英

How to have splash screen at first launch only?

I have a splash activity in my app that launches and then loads the main class after 5 seconds. I'm thinking of changing it to where the splash only displays on the initial launch of the app. I was thinking of just writing a text file to the filesystem and then checking to see if its there. If its found, then dont load the splash screen. Is there a better way of doing a check to see if the app is on the first launch?

Instead of that you can use SharedPreferences because its easy to implement, fetch and take values from it as compared to file system.

Refer this question for the example of SharedPreference: Android-sharedpreference

您可以使用SharedPreference保存代表初始屏幕的简单字符串。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM