//将bitmap保存为本地文件
File PHOTO_DIR = new File(Environment.getExternalStorageDirectory()+"image");//设置保存路径
File avaterFile = new File(PHOTO_DIR, "avater.jpg");//设置文件名称
if(avaterFile.exists()){avaterFile.delete();
}
try {
avaterFile.createNewFile();
FileOutputStream fos = new FileOutputStream(avaterFile);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
fos.flush();
fos.close();
} catch (IOException e) {
e.printStackTrace();
}
//读取本地图片
Bitmap bitmap = null;
try{
File avaterFile = new File(PHOTO_DIR, "avater.jpg");
if(avaterFile.exists()) {
bitmap = BitmapFactory.decodeFile(PicTool.PHOTO_DIR+"/avater.jpg");
}
} catch (Exception e) {}