final boolean isFirst;
SharedPreferences preferences = getSharedPreferences("first_pref",MODE_MULTI_PROCESS);
isFirst = preferences.getBoolean("isFirstIn", true);
Log.d("StartActivity","is"+isFirst);
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.start_layout);
new Handler().postDelayed(new Runnable() {
public void run() {
if (isFirst) {
// start
intent = new Intent(StartActivity.this, GuideActivity.class);
} else {
// start
intent = new Intent(StartActivity.this, MainActivity.class);
}
StartActivity.this.startActivity(intent);
StartActivity.this.finish();
}
},DISPLAY_TIME);
后面在GuideActivity中修改了文件中isFirst的值为false,但实验发现结果不行,
final boolean isFirst;中声明为final是应为在内部类中不能用变量。
求各位大神指点,谢谢你们