I have an activity that i only want to run when the application is ran for the first time.
And never again. It is a facebook login activity. I only want to launch it once when the app is initially opened for the first time.
How do i go about doing this?
What I’ve generally done is add a check for a specific shared preference in the
Main Activity: if that shared preference is missing then launch the single-run Activity, otherwise continue with the main activity . When you launch the single run Activity create the shared preference so it gets skipped next time.EDIT : In my
onResumefor the default Activity I do this:Basically I load the default shared preferences and look for the
previously_startedboolean preference. If it hasn’t been set I set it and then launch the help file. I use this to automatically show the help the first time the app is installed.