Created
April 14, 2015 14:24
-
-
Save koocbor/368dcd73088f4b87731b to your computer and use it in GitHub Desktop.
Save image to Media Android
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
public static Uri addImageToGallery(Context context, String filepath, String title, String description) { | |
ContentValues values = new ContentValues(); | |
values.put(Media.TITLE, title); | |
values.put(Media.DESCRIPTION, description); | |
values.put(Images.Media.DATE_TAKEN, System.currentTimeMillis()); | |
values.put(Images.Media.MIME_TYPE, "image/jpeg"); | |
values.put(MediaStore.MediaColumns.DATA, filepath); | |
return context.getContentResolver().insert(Media.EXTERNAL_CONTENT_URI, values); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment