AlertDialog.Builder 为什么显示第二次的时候会停止工作android

解决方案 »

  1.   

    passwordText = new AlertDialog.Builder(this);
    passwordText.setTitle("请输入密码");
    passwordText.setView(new EditText(getApplicationContext()));

    passwordText.setPositiveButton("确定", null);
    passwordText.setNegativeButton("取消", null);
    上面是代码,我在接下来的代码中会调用 passwordText.show(),第一次调用的时候没问题,第二次调用的时候会停止工作。
      

  2.   

    我是直接在真机上运行,直接程序意外停止了,因为涉及到wifi。只能在真机上运行,,,我现在单独把这块拿到Junit里测试下,看报什么错,
      

  3.   

    在Junit里还是不好测试,因为要传入上下文才可以创建组件,,,
      

  4.   

    找到错误日志了,java.lang.RuntimeException:Unable to start activity ComponentInfo{cn.king.****}