public void saveBitmap(Bitmap bitmap) {
FileOutputStream fOut;
try {
File dir = new File("/sdcard/demo/");
if (!dir.exists()) {
dir.mkdir();
}
String tmp = "/sdcard/demo/takepicture.jpg";
fOut = new FileOutputStream(tmp);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fOut);
try {
fOut.flush();
fOut.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
沒有留言:
張貼留言