私は自分のアカウントを切り替えることができるアプリケーションを開発しています。現在、1つのアカウントでアプリを許可することができます。ユーザーに別のアカウントを作成して、アンドロイドアプリでそれらのアカウントを切り替える方法を教えてください。1ユーザーの複数のアカウント1 android appはログインアクティビティからスプラッシュスクリーンアクティビティにデータを転送します
アップデート: - 私のlogin.classで
I'm able to auth by Google button (firebase)
I want to do something like this in my app!
私は私がfirebaseからもらったUIDの値を保存。今私はこのデータを自分のスプラッシュスクリーンに送って、uid == nullならそれをチェックし、ログインにリダイレクトし、uid!= nullならMainActivityにリダイレクトします。
login.class
String MyPREFERENCES = "MyPrefs" ;
String uid = "uidKey";
SharedPreferences sharedpreferences = login.this.getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putString("uid", UID);
editor.putBoolean("is_logged_before",true); //this line will do trick
editor.commit();
Toast.makeText(login.this,"uid:"+UID,Toast.LENGTH_LONG).show();
String uid1 = sharedpreferences.getString("uid", "");
Log.i("shareduser",uid1);
Intent i = new Intent(login.this,splashScreen.class);
i.putExtra("message",uid1);
startActivity(i);
スプラッシュスクリーン
パブリッククラススプラッシュスクリーンアクティビティを拡張{
private static int SPLASH_TIME_OUT = 2000;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splashscreen);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
/*Bundle bundle = getIntent().getExtras();
String message = bundle.getString("message");
Log.i("received uid",message);*/
Intent homeIntent = new Intent(splashScreen.this, login.class);
startActivity(homeIntent);
finish();
}
},SPLASH_TIME_OUT);
}
}
は、あなたのいくつかの現在の実装では、私は私のクエリを更新しました –
手順提供し確認してください。 –