I wanted to have a popup window when the user opens the application for the first time.
How can I check/get the number of times that the application has been opened?
Please help. Thanks a lot.
When your application starts, during the onCreate()
method, you can check to see if a SharedPreference exists. If it does not, it is the first time this application is being launched. Then create the SharedPreference. So each subsequent time the application launches, the value will already be set and you'll know that it wasn't launched for the first time.
For more details on reading and setting SharedPreferences check out the documentation: http://developer.android.com/guide/topics/data/data-storage.html#pref
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With