I’m designing an application that has an activity for registration process, this activity launches on default. I want this activity to be disabled forever once the registration process has been completed successfully and then it should be replaced by a different activity as the default activity for the rest of the lifetime of the application.I’ve tried to search my way through this problem but I’ve hardly found anything.Any help will be much appreciated.
Thanks in advance.
I’m designing an application that has an activity for registration process, this activity launches
Share
Once registration is complete, commit some value to the SharedPreferences, then in your splash screen or some other opening Activity, check the preferences. If the value indicates that the registration is complete, start a different Activity instead of the Registration one…
Example:
Better still:
Always launch the registration, but in
onCreate(), simply launch a different Activity immediately andfinish()the registrationActivityif the prefs indicate that registration is complete.Edit
SharedPreferences explained:
SharedPreferences lets you persist primitive values in your app. You grab the SharedPreferences by doing:
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
then you write to SharedPreferences by getting the Editor. To do this, you call
then you can commit values to the editor by using key/values:
Then to actually save that, you call
editor.commit();Then you grab values back from SharedPreferences by simply calling
where true/false is the default value that will be returned if no such key exists…
This is convenient and lets you do simple things like:
……later
Also, please see: http://developer.android.com/guide/topics/data/data-storage.html#pref