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.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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