Glide錯誤java.lang.IllegalArgumentException: You cannot start a load for a destroyed activity


解決辦法 在使用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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM