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

拜拜、爱过 提交于 2020-03-23 13:18:46

解决办法 在使用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();

            Glide.with(this).pauseRequest();

        }

子线程所有的this 都要写成getApplicationContext //这个主要针对于在子线程使用Glide

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!