java.lang.IllegalArgumentException: View=DecorView@4b56afc[] not attached to window manager

2020-02-04 18:51:22

产生原因是我对异步关闭对加载动画,所以出现了问题。

所以异步对时候要考虑activity是否还存在。


使用Dialog的时候,没少出现下面这个报错

出现的原因:因为你的Dialog的生命周期比你的activity的生命周期要长

所以,出现这个bug的时候,请检查创建这个Dialog的context所属的Activity是不是已经结束了,而dialog还在显示。

解决方法:


1.请检查,是否还未等Dialog消失就提前结束Activity。如果是,肯定是你的逻辑出问题了,还没等Dialog结束就结束Activity。


2.不管什么情况,Activity一结束,确定要关闭Dialog。那么可在onStop或者onPause里面关闭dialog



  • 2017-11-10 00:06:15

    CORS: credentials mode is 'include'

    XMLHttpRequest cannot load http://localhost/Foo.API/token. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:5000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

  • 2017-11-19 00:17:51

    Java如何获取Date的“昨天”与“明天”示例代码

    最近在做项目的时候用到Date和Calendar比较多,而且用到的方式也比较全,突然想到一个问题,Java如何获取Date的"昨天"与"明天",也就是前一天和后一天呢?思考后写出了方法,想着万一以后用到,就总结出来,也方便有需要的朋友们参考借鉴,下面来一起看看吧。