1

As you can see by the code below, I save the bitmap to a public picture directory. I have also provided a screenshot of the images in storage, as further proof that the images are being saved.

The problem is that the images do not show up in the Photo app, until I reboot my phone. I have checked other apps, and those pictures show up immediately. If I open the image, I also cannot edit it (e.g. add effects) like I can other pictures.

enter image description here

 Bitmap b = Bitmap.createScaledBitmap(mBitmap, width, height, false);

                Long uuid = UUID.randomUUID().getMostSignificantBits();
            File path = Environment.getExternalStoragePublicDirectory(
                    Environment.DIRECTORY_PICTURES + "/test");

            if(!path.exists() && !path.isDirectory()){
                path.mkdirs();
            }

            Log.i("Directory:", path.toString());

            File file = new File(path, "test_" + uuid + ".jpg");

            if (file.exists()){
                file.delete();
            }

            FileOutputStream out = null;
            try {
                out = new FileOutputStream(file);
                b.compress(Bitmap.CompressFormat.JPEG, 80, out);

            } catch (Exception e) {
                e.printStackTrace();
            } finally {
                try {
                    if (out != null) {
                        out.close();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }

        }
    });
HaloMediaz
  • 1,251
  • 2
  • 13
  • 31
  • Have a look on [this][1] stack overflow link [1]: http://stackoverflow.com/questions/20001662/how-to-update-gallery-after-moving-photo-programmatically – Anand Makwana May 08 '15 at 04:12

1 Answers1

0

You must send a notification when adding a new image

getContentResolver().notifyChange(
    Uri.parse("file://sdcard/abc.png");
mort
  • 12,988
  • 14
  • 52
  • 97
  • The problem is tat the second argument of notifyChange needs to be a content observer. :/ – HaloMediaz May 08 '15 at 15:19
  • From another comment, this solution worked: http://stackoverflow.com/questions/20001662/how-to-update-gallery-after-moving-photo-programmatically – HaloMediaz May 08 '15 at 15:32