在使用一个自定义dialog报错Unable to add window -- token null is not for an application
captchaDialog = new GyHardCaptchaDialog(this.getApplicationContext(), new GyBaseCaptchaDialog.CaptchaListener() { @Override public void getCaptcha(String captcha, String captchaCookie) { LogUtil.e("验证码is"+ captcha); } });Application是全局的,dialog应该附加在一个窗体上,修改为Activity.this就可以了
captchaDialog = new GyHardCaptchaDialog(AccountLoginActivity.this, new GyBaseCaptchaDialog.CaptchaListener() { @Override public void getCaptcha(String captcha, String captchaCookie) { LogUtil.e("验证码is"+ captcha); } });