判断是否为第一次登陆

//判断是否为第一次登陆

public void getData(){
SharedPreferences sp=getSharedPreferences(“login”, Context.MODE_PRIVATE);
int count=sp.getInt(“count”, 0);
if (count == 0){
SharedPreferences.Editor et=sp.edit();
et.putInt(“count”,1);
et.commit();
Intent intent=new Intent(LoadingActivity.this,StartActivity.class);
startActivity(intent);
finish();
}else {
//第二次或更多进入
Intent intent=new Intent(LoadingActivity.this,LoginActivity.class);
startActivity(intent);
finish();
}
}

猜你喜欢

转载自blog.csdn.net/weixin_42791904/article/details/85272311