データベースのフラグ列を使用して2つの異なるアクティビティにディスパッチするログインボタンを作成しますか?Androidスタジオ:1つのボタンで2種類のアクティビティ
それにログインテナントはテナントの活動
にリダイレクトし、家主はそれでログインしているときに、他の活動にリダイレクトされますか?あなたのlog in
ボタンのonClickListener()メソッド内
public void onResponse(String response) {
Log.e(TAG, "Register Response: " + response.toString());
hideDialog();
try {
JSONObject jObj = new JSONObject(response);
success = jObj.getInt(TAG_SUCCESS);
// Check for error node in json
if (success == 1) {
String username = jObj.getString(TAG_USERNAME);
String id = jObj.getString(TAG_ID);
Log.e("Successfully Login!", jObj.toString());
Toast.makeText(getApplicationContext(), jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
SharedPreferences.Editor editor = sharedpreferences.edit();
editor.putBoolean(session_status, true);
editor.putString(TAG_ID, id);
editor.putString(TAG_USERNAME, username);
editor.commit();
// go to main activity
Intent intent = new Intent(LoginActivity.this, MainActivity.class);
intent.putExtra(TAG_ID, id);
intent.putExtra(TAG_USERNAME, username);
finish();
startActivity(intent);
} else {
Toast.makeText(getApplicationContext(),
jObj.getString(TAG_MESSAGE), Toast.LENGTH_LONG).show();
}
} catch (JSONException e) {
// JSON error
e.printStackTrace();
}
}
if文を追加して、その中にインテントを使用して、条件 –
java? PHP?私はそれに置く必要がありますどのような状態@DheerajJoshiと迷惑メールタグ – nogad
をしないでください?? –