登録ページとアカウント作成ページが必要です。アカウントの作成ページで情報を入力した後、アカウント作成に成功したか、コードが再送信されたかを示すダイアログボックスが表示された登録ページに戻ります。前のアクティビティで行ったことに基づいて、別のアクティビティでダイアログボックスを表示する方法
現在のところ、ウェブサーバーの応答を確認していますが、状況によってはダイアログボックスが表示され、アカウントの作成アクティビティが閉じ、ダイアログボックスがポップアップしている間に背景に登録ページが表示されますアカウントが作成されるか、コードが再送信されます。
しかし、現在のところ、ダイアログボックスを表示せずに自分のアクティビティを閉じることができます。私は登録ページでダイアログを開く必要があると仮定していますが、作成されたか再送信されたかを尋ねる方法はわかりません。私が言ったことに基づいて適切なダイアログを表示する方法についてのヒントを教えていただけたら、私はとても感謝しています。
はここ
は私のコードは ノートであるあなたがあなたのAlertDialogビルダーのsetNeutralButtonで情報を記入
public void btnCreate(View v) throws Exception {
// if we get to here we can send the information to the webserver
String response = makeRequest(email.getText().toString(), fName
.getText().toString(), lName.getText().toString());
if (response != null) {
org.json.JSONObject obj = new org.json.JSONObject(response);
//response is created make created dialog
if ("Created".equals(obj.getString("status"))) {
new AlertDialog.Builder(CreateAccount.this)
.setTitle("Account Creation Successful")
.setMessage(
"An activation code has been sent to you. Please check your SPAM folder if you do not receive your activation code email")
.setNeutralButton("OK", null).show();
// response is resend and sends the resend dialog
} else if ("Resend".equals(obj.getString("status"))) {
new AlertDialog.Builder(CreateAccount.this)
.setTitle("Code Resent")
.setMessage(
"Your activation code has been resent to your email.\n\nIf you are not receiving your activation code, our email is being blocked. Please email us at '[email protected]' and we will manually send you a code.")
.setNeutralButton("OK", null).show();
}
}
//finishes this activity and shows the registration activity (the one before create account)
finish();
}
は完全に動作します。 。 – Sean