How to save image in android gallery

here is what you should enter, when you're about to save the picture in the Gallery

MediaStore.Images.Media.insertImage(getContentResolver(), yourBitmap, yourTitle , yourDescription);

That code will add the image at the end of the Gallery. so please, check your Gallery picture, to be sure


the gallery don't displaying (necessarily) files from external storage.

this is a common mistake.

the gallery displays images stored on the media store provider

you can use this method to store image file on media store provider:

public static void addImageToGallery(final String filePath, final Context context) {

    ContentValues values = new ContentValues();

    values.put(Images.Media.DATE_TAKEN, System.currentTimeMillis());
    values.put(Images.Media.MIME_TYPE, "image/jpeg");
    values.put(MediaStore.MediaColumns.DATA, filePath);

    context.getContentResolver().insert(Images.Media.EXTERNAL_CONTENT_URI, values);
}