0

I am working on an application which contain register activity as it's first page which is on tabs. i want that once the user is register then whenever the user starts the application it should always run from main menu screen and should never display the register screen till the user uninstall the application and reinstall it again.

Cœur
  • 37,241
  • 25
  • 195
  • 267
arsh.somal
  • 61
  • 1
  • 13

2 Answers2

1

you can use SharedPreferences. This is an example:

SharedPreferences mPrefs = getSharedPreferences("MyPreferences", Context.MODE_PRIVATE);
SharedPreferences.Editor editor = mPrefs.edit();
editor.putBoolean("firstTime", true);
editor.commit();

So you can check if firstTime is true doing this:

SharedPreferences mPrefs = getSharedPreferences("MyPreferences", Context.MODE_PRIVATE);
if(mPrefs.getBoolean(firstTime, false){
    //show screen
} 
Stefano Ortisi
  • 5,288
  • 3
  • 33
  • 41
0

Set your AndroidManifest to start the MainActivity as the default activity.

Then in the onCreate check if the user has registered (perhaps store this in SharedPreferences), if they have NOT registered - instantly start the intent for your RegisterActivity, otherwise carry on as normal.

Blundell
  • 75,855
  • 30
  • 208
  • 233