setView的AlertDialog在受到二次点击后出错
错误报告: 10-21 13:11:16.009: E/AndroidRuntime(27937): FATAL EXCEPTION: main 10-21 13:11:16.009: E/AndroidRuntime(27937): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first. 问题分析: 在获取自定义View的过程中,setView()使用了我定义的edit_view(EditText类型),根据报错结果,edit_view已经把第一次点击生成的对话框作为自己的父组件,父与子一对多。 Builder dialog = new AlertDialog.Builder( CompleteProfileActivity. this ).setTitle("请输入昵称" ) .setView(edit_view) .setPositiveButton( "确定" , positiveListener) .setNegativeButton( "取消" , negativeListener); dialog.show(); 检查发现我的edit_view写在了onCreate