java - Images not showing up in photos app, until I reboot my phone -


as can see code below, save bitmap public picture directory. have provided screenshot of images in storage, further proof images being saved.

the problem images not show in photo app, until reboot phone. have checked other apps, , pictures show immediately. if open image, cannot edit (e.g. add effects) 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();             } {                 try {                     if (out != null) {                         out.close();                     }                 } catch (ioexception e) {                     e.printstacktrace();                 }             }          }     }); 

you must send notification when adding new image

getcontentresolver().notifychange(     uri.parse("file://sdcard/abc.png"); 

Comments