I have a function::
public void onPictureTaken(byte[] data, Camera camera) {
//Creating the Image file here
}
public static void addImageToGallery(final String filePath, final Context context) {
ContentValues values = new ContentValues();
values.put(MediaStore.Images.Media.DATE_TAKEN, System.currentTimeMillis());
values.put(MediaStore.Images.Media.MIME_TYPE, "image/jpeg");
values.put(MediaStore.MediaColumns.DATA, filePath);
context.getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, values);
}
- How to create a file from
dataproperly. - I want to create a file and get the absolute path of the file
- Finally I want to add the image into the gallery, for which I already have the function
MediaStore.Images.Media#insertImage()MediaStore.Images.Media#insertImage()