Control page at the first file
I want to create app which have a tip page =show how to use this app and at tip page have 2 button (skip and continue)if 开发者_开发百科user press skip button it view go to main page and if press continue button it will show another tip
and at the main page user can set the value "show tip box at the first time" if user don't want to show tip box user can check this and next time user use this app it will show main page as the first page
so I have to create control page to check the value show tip box at the first time in database before show tip page or main page and the problem is I don't want to show control page
How to resolve this problem
What should I do with my Manifest
U can use shared preference for this..
static SharedPreferences notify_Settings;
public static SharedPreferences.Editor editor;
public static final String PREFS_NAME = "Desired Name";
notify_Settings=getSharedPreferences(PREFS_NAME, 0);
SharedPreferences.Editor editor = notify_Settings.edit();
if (settings.getBoolean("firsttime", false) == false ){
editor.putBoolean("firsttime",true;
editor.commit();
//Some code here
startActivity(new Intent(Page 1.this, Page 2.class));
}else{
//Some code here
startActivity(new Intent(Page 1.this, Page 3.class));
}
First time it will return false since there will be no value (i.e) false in the shared preference so if (condition) gets true and do your procees and Redirect the page to the Page 2.class
If you run the application again this condition will become false since the value in shared preference will be "true" now so this way you can control your page Redirections..
精彩评论