私はたくさんグーグルで検索しましたが、解決策が見つかりませんでした。電子メールと、[送信] と [キャンセル] の 2 つのボタンを備えたアラート ダイアログを使用してEditText
おり、さまざまなアラートを表示する必要がある条件に基づいています。しかし、強制終了エラーが発生し、次のように表示されlogcat
ます:
05-16 13:16:48.281: E/AndroidRuntime(13572): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
05-16 13:16:48.281: E/AndroidRuntime(13572): at android.view.ViewGroup.addViewInner(ViewGroup.java:1976)
05-16 13:16:48.281: E/AndroidRuntime(13572): at android.view.ViewGroup.addView(ViewGroup.java:1871)
05-16 13:16:48.281: E/AndroidRuntime(13572): at android.view.ViewGroup.addView(ViewGroup.java:1851)
以下は、アラート ダイアログにアラート ダイアログを表示するコードです。
forgetPasswordMailAlert() は:
private void forgotPasswordMailAlert(String AlertText)
{
final AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setMessage(AlertText)
.setCancelable(true)
.setPositiveButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
dialog.dismiss();
}
});
AlertDialog alert = builder.create();
alert.show();
}
私もStackoverflowでよく検索しました。コードを変更する必要がある場所を教えてください。この問題を解決する方法を教えてください。