SharedPreferences的简单使用



    SharedPreferences sharedPreferences=getSharedPreferences("day",MODE_WORLD_READABLE);
    //获取对象
    boolean day=sharedPreferences.getBoolean("day",true);
    if(day){  //第一次进入 存值代表进入过  第二次跳转页面
        SharedPreferences.Editor editor=sharedPreferences.edit();
        editor.putBoolean("day",false);
        editor.commit();
    }else{
        startActivity(new Intent(MainActivity.this,Main2Activity.class));
        finish();
    }

猜你喜欢

转载自blog.csdn.net/wg_1176075838/article/details/79009731