Glide設定和獲取快取的路徑

2021-08-18 22:03:44 字數 1028 閱讀 1481

1.介面glidemodule實現glidebuider的實現類指定快取的路徑

public class giphyglidemodule implements glidemodule 

@override

//設定的顯示格式argb_8888(指大小為32bit)

builder.setdecodeformat(decodeformat.prefer_argb_8888);

builder.setdiskcache(new diskcache.factory()

});}

@override

public void registercomponents(context context, glide glide)

}

2:在androidmanifest中配置giphyglidemodule

3.獲取快取的路徑

private class getimageasynctask extends asynctask

@override

protected file doinbackground(string... params) catch (exception ex)

}@override

protected void onpostexecute(file result)

//此path就是對應檔案的快取路徑

string path = result.getpath();

log.e("path", path);

bitmap bmp= bitmapfactory.decodefile(path);

img.setimagebitmap(bmp);

}}

4.呼叫方法

new getimageasynctask(addbigimageactivity.this).execute("uri");

Glide獲取快取大小以及清除快取

compile com.github.bumptech.glide glide 3.7.0 呼叫工具類獲取快取大小 string cachesize glidecacheutil.getinstance getcachesize this clean.settext cachesize dingwe...

glide的快取策略

本文主要介紹了如何配置和管理glide中的快取,其中大部分內容都可以直接在官方wiki中找到,這裡只是進行了整理和彙總。言歸正傳,glide支援的二級快取 並不是 快取,因為從網路載入並不屬於快取 即記憶體快取和磁碟快取。磁碟快取 一般的快取指的就是磁碟快取,把網路上的快取到本地,這樣就不需要每次都...

FireFox瀏覽器快取路徑設定

1 快取400m,c盤可惜了,調整到d盤 about cache 檢視路徑 位址列輸入 about config,右鍵新建兩個字串。乙個名為 browser.cache.disk.parent directory 硬碟快取 然後輸入新的快取檔案儲存路徑 另乙個名為 browser.cache.off...