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是應為在內部類中不能用變量。
求各位大神指點,謝謝你們
http://www.cnblogs.com/Amandaliu/archive/2012/12/03/2800072.html