情况描述:
使用自定义的对话框时,Context传入了MyApp下的全局context。导致报错。
Android.view.WindowManager$BadTokenException: Unable to add window – token null is not for an application
解决方案:传入Activity的context,因为只有Activity才能添加Window。
情况描述:
使用自定义的对话框时,Context传入了MyApp下的全局context。导致报错。
Android.view.WindowManager$BadTokenException: Unable to add window – token null is not for an application
解决方案:传入Activity的context,因为只有Activity才能添加Window。