A 라는 AlertDialog 와 B 라는 AlertDialog 가 있습니다. 둘다 AlertDialog.Builder 로 생성하였구요,
취하고있는 View 도 둘다 틀리구요. 각각의 View 는 Inflate 하엿습니다.
A 의 Positive 버튼을 누르면 B 의 AlertDialog 가 나오고
B 의 Positive 버튼을 누르면 A 의 AlertDialog 가 나오는 형식을 취하려고 합니다.
01-13 15:00:18.110: E/AndroidRuntime(4112): FATAL EXCEPTION: main
01-13 15:00:18.110: E/AndroidRuntime(4112): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.view.ViewGroup.addViewInner(ViewGroup.java:3011)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.view.ViewGroup.addView(ViewGroup.java:2900)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.view.ViewGroup.addView(ViewGroup.java:2880)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.android.internal.app.AlertController.setupView(AlertController.java:415)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.android.internal.app.AlertController.installContent(AlertController.java:255)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.app.AlertDialog.onCreate(AlertDialog.java:314)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.app.Dialog.dispatchOnCreate(Dialog.java:335)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.app.Dialog.show(Dialog.java:248)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.app.AlertDialog$Builder.show(AlertDialog.java:907)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.bizbile.appscares.Settings$9.onClick(Settings.java:367)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.android.internal.app.AlertController$ButtonHandler.handleMessage(AlertController.java:168)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.os.Handler.dispatchMessage(Handler.java:99)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.os.Looper.loop(Looper.java:132)
01-13 15:00:18.110: E/AndroidRuntime(4112): at android.app.ActivityThread.main(ActivityThread.java:4028)
01-13 15:00:18.110: E/AndroidRuntime(4112): at java.lang.reflect.Method.invokeNative(Native Method)
01-13 15:00:18.110: E/AndroidRuntime(4112): at java.lang.reflect.Method.invoke(Method.java:491)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:844)
01-13 15:00:18.110: E/AndroidRuntime(4112): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
01-13 15:00:18.110: E/AndroidRuntime(4112): at dalvik.system.NativeStart.main(Native Method)
그런데 에러가 뜨고 마네요... setPositiveButton 의 onClick 메소드에서 B 의 Alertdialog 를 show() 하였고 B 에서도 마찬가지입니다.
왜그런것일까요?




둘이 공통으로 사용하는 View나 레이아웃이 있나요?
어떤 클래스가 문제가 아니고... 어떤 뷰 객체를 공유하는 넘이 있는가 하는 점입니다.