SharedPreferencesを使用できます。これらの設定は、この目的で使用するために保存されます。
class MainMenu extends Activity {
protected static final String PREFS_USER = "user";
@Override
public void onStart() {
super.onStart(); //don't forget this, because you must call parent onStart method
SharedPreferences prefs = getSharedPreferences( PREFS_FILE, 0);
String userKey = prefs.getString("userKey", null );
//if user key is not set yet, you should open registration Activity
if (userKey == null) {
Intent intent = new Intent(this, Registration.class);
startActivity(intent);
}
}
}
完了後にユーザー登録を再確認する必要があるため、onStartメソッドを使用します。
次に、ユーザー成功登録、次のコードでユーザーキーを設定できます。
SharedPreferences prefs = getSharedPreferences( PREFS_FILE, 0);
prefs.edit().putString("userKey", userKey ).commit();
さらに、startActivityforResultと組み合わせることができます
いくつかの追加のリファレンスと説明はここにあります。