Created
October 29, 2019 08:31
-
-
Save hjiee/0cf19aa52e85042bb5638e0a8586f6b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void beforeQ() { | |
String strFolderPath = Environment.getExternalStorageDirectory().getAbsolutePath() + CAPTURE_PATH; | |
File folder = new File(strFolderPath); | |
if (!folder.exists()) { | |
folder.mkdirs(); | |
} | |
OutputStream out = null; | |
String strFilePath = strFolderPath + "/"; | |
try { | |
File fileCacheItem = new File(strFilePath + fileName); | |
fileCacheItem.createNewFile(); | |
out = new FileOutputStream(fileCacheItem); | |
// 비트맵을 png로 변환 | |
bmp.compress(Bitmap.CompressFormat.PNG, 100, out); | |
// 미디어 스캐닝을 하여 삭제,추가 정보를 알린다. | |
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(fileCacheItem))); | |
} catch (Exception e) { | |
e.printStackTrace(); | |
} finally { | |
try { | |
if (out != null) { | |
out.close(); | |
} | |
} catch (IOException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment