アプリケーションがセルで初めて起動されたときにアプリのパスワードを作成する activity_create_password という名前のアクティビティを作成しました。次回以降は、activity_insert_password という名前のアクティビティが表示されます。どうすればこれを達成できますか 助けてください。
2793 次
2 に答える
1
これを達成するには使用SharedPreferences
する必要があります。コードは次のようになります
SharedPreferences prefs = mContext.getSharedPreferences("appName", 0);
SharedPreferences.Editor editor = prefs.edit();
Intent intent;
if (prefs.getBoolean("isInitialAppLaunch", false))
{
intent = new Intent(this, activity_insert_password.class);
startActivity(intent);
}
else
{
//First Time App launched, you are putting isInitialAppLaunch to false and calling create password activity.
editor.putBoolean("isInitialAppLaunch", false);
intent = new Intent(this, activity_create_password.class);
startActivity(intent);
}
于 2013-10-01T05:24:00.393 に答える
0
于 2013-10-01T07:16:38.063 に答える