Unable to add window -- token android.os.BinderProxy

2023-05-16

 

The problem is that the dialog need to have the "base" context of your activity, not necessarily the one you're launching it from.

然后我在弹dialog之前加上了这段代码

[java] view plain copy

  1. Activity activity =RActivity.this;  
  2.                                             while (activity.getParent() != null) {  
  3.                                                 activity = activity.getParent();  
  4.                                             }  
  5.                                             new AlertDialog.Builder(activity)  
  6.                                                     .setTitle(  
  7.                                                             getString(R.string.atitle))  
  8.                                                     .setMessage(errMessage)  
  9.                                                     .setPositiveButton(  
  10.                                                             getString(R.string.ok),  
  11.                                                             null).show();  
  12.                                               
  13.                                         }  
  14.                                     });  
  15.  
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Unable to add window -- token android.os.BinderProxy 的相关文章

随机推荐