// 得到SharedPreferences
SharedPreferences sharedPreferences = getSharedPreferences("xin",
MODE_PRIVATE);
// 给SharedPreferences存个值
boolean boolean1 = sharedPreferences.getBoolean("flag", true);
// 进入判断
if (boolean1) {
viewPager
.setAdapter(new ViewAdapter(MainActivity.this, al, handler));
Editor edit = sharedPreferences.edit();
edit.putBoolean("flag", false).commit();
} else {
// 如果不符合就跳转
startActivity(new Intent(MainActivity.this, OneActivity.class));
}
SharedPreferences导航
最新推荐文章于 2021-05-27 16:47:16 发布