您的位置:首页 > 编程语言 > Java开发

【一】Glide错误java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity

2016-01-21 15:01 645 查看
解决办法 在使用Glide的那段代码加是否在主线程判断

if(Util.isOnMainThread()) {
Glide.with(ClassifyItemDetailActivity.this).load(ConstantsYiBaiSong.CLASSIFY_LIST_ITEM_DETAIL_IMAGE
+ lists.get(i).get(
"face"))
.diskCacheStrategy(DiskCacheStrategy.ALL).into(imageView);
}


在onDestory加

@Override
protected void onDestroy() {
super.onDestroy();
if(Util.isOnMainThread()) {
Glide.get(this).clearMemory();
}
}


并且所有的this 都要写成getApplicationContext

问题解决。不要问我为什么 因为报错的根源都是判断结论不在主线程。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: