public class ImageHelper { private Context mContext; private static ImageHelper instance = null; public synchronized static ImageHelper getInstance(Context context) { if (instance == null) { instance = new ImageHelper(context.getApplicationContext()); } return instance; } private ImageHelper(Context context) { mContext = context; } public Bitmap loadImage(String filePathOrUrl) throws ClientProtocolException, IOException, HttpRequestException { Bitmap ret = null; if (filePathOrUrl.startsWith("http")) { // 是否有缓存 String fileName = generateDiskCacheKey(filePathOrUrl, 0, 0, false); File file = null; file = new File(mContext.getCacheDir(), fileName);// 保存文件 if (!file.exists()) { HttpUtil.download(filePathOrUrl, file); ret = BitmapFactory.decodeFile(file.getAbsolutePath()); } else { String imagePath = mContext.getCacheDir() + "/" + fileName; ret = BitmapFactory.decodeFile(imagePath); } } else { ret = BitmapFactory.decodeFile(filePathOrUrl); } return ret; } } public class SaveImage { BaseActiv