代码:
preferences = getSharedPreferences("count",MODE_WORLD_READABLE); int count = preferences.getInt("count", 0); //判断程序与第几次运行,如果是第一次运行则跳转到引导页面 if (count == 0) { Intent intent = new Intent(); intent.setClass(getApplicationContext(),LaunchGuideViewActivity.class); startActivity(intent); this.finish(); } Editor editor = preferences.edit(); //存入数据 editor.putInt("count", ++count); //提交修改 editor.commit();