我想在安装后第一次运行应用程序时运行代码。再也不会怎么做
以下是这里的代码是我正在尝试的方式
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SecurityPrefs.setAutoSavePattern(this, true);
String settingsTAG = "AppNameSettings";
SharedPreferences prefs = getSharedPreferences(settingsTAG, 0);
boolean run = prefs.getBoolean("run", false);
if (run == false)
{
run = true;
Intent intent = new Intent(LockPatternActivity.ACTION_CREATE_PATTERN, null,
this, LockPatternActivity.class);
startActivityForResult(intent, REQ_CREATE_PATTERN);
}
else
{ Intent intent1 = new Intent(LockPatternActivity.ACTION_COMPARE_PATTERN,null,this,LockPatternActivity.class);
startActivityForResult(intent1, REQ_ENTER_PATTERN);
}
}