`
v5browser
  • 浏览: 1138293 次
社区版块
存档分类
最新评论

一些错误

 
阅读更多

报错一关于Unable to add window -- token null is not for an application 的错误:

android.view.WindowManager$BadTokenException: Unable to add window -- token null is not for an application。

ProgressDialog progressDialog=new ProgressDialog(context);
此处的context 要保证你的上下文要为activity对象,只有activity才能添加ProgressDialog窗体,
为了确保正确,context可以使用activity.this表示,不要一味地写成getApplicationContext()

报错二:
Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
context 不能启动Acitvity 增加intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics