Created
July 20, 2017 04:21
-
-
Save vtthach/b65ca8e1c574f8786e1c6e561470b5aa to your computer and use it in GitHub Desktop.
Notify gallery insert an image with path
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
// 其次把文件插入到系统图库 | |
try { | |
MediaStore.Images.Media.insertImage(view.getMyContext().getContentResolver(), file.getAbsolutePath(), fileName, null); | |
} catch (FileNotFoundException e) { | |
e.printStackTrace(); | |
} | |
// 最后通知图库更新 | |
view.getMyContext().sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse("file://" + file.getPath()))); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment