Skip to content

Instantly share code, notes, and snippets.

@koocbor
Created April 14, 2015 14:24
Show Gist options
  • Save koocbor/368dcd73088f4b87731b to your computer and use it in GitHub Desktop.
Save koocbor/368dcd73088f4b87731b to your computer and use it in GitHub Desktop.
Save image to Media Android
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