1.
/**
* 读取大图片
* @param key
* @return
*/
public Bitmap getBitmap(String key){
Bitmap bitmap = null;
BitmapFactory.Options sBitmapOptions = new BitmapFactory.Options();
sBitmapOptions.inPurgeable=true;
File bitmapFile = new File(key);
if(bitmapFile != null){
try {
bitmap = BitmapFactory.decodeStream(new FileInputStream(bitmapFile), null, sBitmapOptions);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
if(bitmap != null){
return bitmap;
}
}
return null;
}
private File getFile(String fileName) throws FileNotFoundException {
File file = new File(mCacheDir, fileName);
if(!file.exists() || !file.isFile())
throw new FileNotFoundException("文件不存在或有同名文件夹");
return file;
}
File file = new File(mCacheDir, fileName);
if(!file.exists() || !file.isFile())
throw new FileNotFoundException("文件不存在或有同名文件夹");
return file;
}