Problems
- The activity which will do registration will be shown only once
- After registration the control should move to
next main activity
I have used following code
Below code will not meet my requirement?
Any Help will be appreciated!!
Code in Registration Activity
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor=prefs.edit();
editor.putBoolean("registration", true);
editor.commit();
Code in Main Activity
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
boolean regComplete =prefs.getBoolean("registration", false);
SharedPreferences.Editor editor =prefs.edit();
editor.putBoolean("registration", false);
editor.commit();
if(regComplete)
{
startActivity(new Intent(this, SecureXActivity.class));
} else
{
startActivity(new Intent(this, LoginActivity.class));
}
Just put your Registration code in
SecureXActivity.classand Check for the Registration before
setContentView(), if its not done then startLoginActivity.classAnd in
LoginActivity.classafter registration complete put these code,If you use this approach then I think you don’t need
Main Activity class..And keep in mind this all thing done at time of your application’s first run not at the time of installation.