final AlertDialog.Builder passwdsettingdialog = new AlertDialog.Builder(Settings.this);
passwdsettingdialog.setTitle("비밀번호 설정");
passwdsettingdialog.setView(passwdsettingview);
passwdsettingdialog.setMessage(null);
passwdsettingdialog.setPositiveButton("확인", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
String passwd1 = settings_passwdsettingpasswd1.getText().toString();
String passwd2 = settings_passwdsettingpasswd2.getText().toString();
if(!passwd1.equals(passwd2) || (passwd1.length() != passwd2.length()))
{
Toast.makeText(Settings.this, "비밀번호가 맞지 않습니다.\n다시 입력하여 주십시오.", Toast.LENGTH_SHORT).show();
}
else
{
sharedPreferences_editor.putString("settings_DeviceMissingPasswd", passwd1);
sharedPreferences_editor.commit();
Toast.makeText(Settings.this, "비밀번호가 설정되었습니다.", Toast.LENGTH_SHORT).show();
}
}
});
passwdsettingdialog.setNegativeButton("닫기", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
;
}
});
passwdsettingdialog.create().show();
이미지뷰를 통해 onclickListener 을 달았고, 클릭시 AlertDialog 를 보여주었습니다.
처음 AlertDialog 이용 후에 또다시 이미지뷰를 통해 AlertDialog 에 접근시에 에러가 발생갑니다.
java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
아직 AlertDialog 가 남아있어서 그런가요?




그런듯 싶네요~