这是一个包含异步加载、网络编程、JSON解析、LruCache图片缓存的简易的ListView图文混排Demo
2022-03-13 23:37:24 1.03MB LruCache 图片缓存
1
Android应用源码之listview获取网络图片缓存优化技术实现源码下载
2022-01-12 09:11:07 946KB Android应用源码之list
android 源码学习
2021-12-11 09:04:05 1009KB
用于类似图库,缓存,所困、缩略图 package com.example.cache; import java.io.File; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.lang.ref.SoftReference; import java.util.HashMap; import java.util.Map; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.util.DisplayMetrics; /** * 1.从内存中加载 * 2.本地缓存中加载 * 3.本地加载 * @author Administrator * */ public class LoadCacheImageTool { private Activity activity; private Map cacheMap; public LoadCacheImageTool(Activity activity){ this.activity = activity; this.cacheMap = new HashMap(); } public Bitmap loadCacheImage(String imagePath){ Bitmap bitmap = null; if (cacheMap.containsKey(imagePath)) { bitmap = cacheMap.get(imagePath).get(); if (bitmap!=null) { return bitmap; } } bitmap = loadLocalCacheImage(imagePath); cacheMap.put(imagePath, new SoftReference(bitmap)); return bitmap; } ///mnt/sdcard/bk.png ///mnt/sdcard/cache/bk.png.cache private Bitmap loadLocalCacheImage(String imagePath) { Bitmap bitmap = null; String cacheImagePath = getCacheImagePath(imagePath); File cacheFile = new File(cacheImagePath); if (!cacheFile.exists()) { bitmap = loadLocalBigImage(imagePath); saveToCacheDir(bitmap,cacheImagePath); }else{ try { bitmap = BitmapFactory.decodeStream(new FileInputStream(cacheFile)); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } } return bitmap; } private String getCacheImagePath(String imagePath) { String cacheDir = new File(imagePath).getParent()+"/cache/"; if (!new File(cacheDir).exists()) { new File(cacheDir).mkdirs(); } String newImageName = new File(imagePath).getName()+".cache"; String newImagePath = cacheDir+newImageNam
2021-11-03 21:55:51 2.04MB 图片缓存
1
直接从项目里面拿出来的代码,附带了很多其他代码可供参考,都是亲测测试通过的。里面还附带了php后端代码文件。
1
Android Google官网的图片缓存源码
2021-03-24 12:11:25 811KB Google官网的图片缓存 Android
删除图片缓存文件.bat
2021-02-28 15:01:06 163B window
1
Google官网的图片缓存源码
2021-02-26 15:05:38 820KB Google官网的图片缓存源码
1