如何從WebView使用的cache文件夾中重復使用一些圖片資源:
Java代碼
/** 從緩存裡讀取圖片 */
public Bitmap getPictureFromCache() {
Bitmap bitmap = null;
File file = new File(getCacheDir() + "/webviewCache/10d8d5cd");
try {
FileInputStream is = new FileInputStream(file);
bitmap = BitmapFactory.decodeStream(is);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
return bitmap;
}
作者“Envisage123”