android
비트맵 파일로 떨어트리기
송준근
2017. 12. 14. 19:57
String root = Environment.getExternalStorageDirectory().toString();
File myDir = new File(root + "/Download");
myDir.mkdirs();
String fname = "image.jpg";
File file = new File (myDir, fname);
if (file.exists ()) file.delete ();
try {
FileOutputStream out = new FileOutputStream(file);
bitmap.compress(Bitmap.CompressFormat.JPEG, 100, out);
out.flush();
out.close();
Toast.makeText(mContext, fname + "다운로드 되었습니다", Toast.LENGTH_SHORT).show();
} catch (Exception e) {
e.printStackTrace();
}