public class HandlerActivity extends Activity {
//是否是第一次使用
private boolean isFirstUse;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_handler);
SharedPreferences preferences = getSharedPreferences("isFirstUse",MODE_WORLD_READABLE);
isFirstUse = preferences.getBoolean("isFirstUse", true);
/**
*如果用户不是第一次使用则直接调转到显示界面,否则调转到引导界面
*/
if (isFirstUse) {
startActivity(new Intent(HandlerActivity.this, MainActivity.class));
} else {
startActivity(new Intent(HandlerActivity.this, LoginActivity.class));
}
finish();
//实例化Editor对象
Editor editor = preferences.edit();
//存入数据
editor.putBoolean("isFirstUse", false);
//提交修改
editor.commit();
}
}
//是否是第一次使用
private boolean isFirstUse;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_handler);
SharedPreferences preferences = getSharedPreferences("isFirstUse",MODE_WORLD_READABLE);
isFirstUse = preferences.getBoolean("isFirstUse", true);
/**
*如果用户不是第一次使用则直接调转到显示界面,否则调转到引导界面
*/
if (isFirstUse) {
startActivity(new Intent(HandlerActivity.this, MainActivity.class));
} else {
startActivity(new Intent(HandlerActivity.this, LoginActivity.class));
}
finish();
//实例化Editor对象
Editor editor = preferences.edit();
//存入数据
editor.putBoolean("isFirstUse", false);
//提交修改
editor.commit();
}
}