0

So I wrote this app that takes a picture and saves it in the path file:///storage/emulated/0/images/ In the same app, I need to load pictures from this file.

I could successfully take a photo, but when I try the load function, the photo just took is not showing. However when I reboot my phone and then use the load function, everything taken before the restart is showing !

I just want the photo to show when I use the load function, without rebooting.I don't know if this has anything to do with my phone settings. Does any one know how to amend that? Thanks in advance.

Btw in Manifest I already have :

   <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
   <uses-permission android:name="android.permission.CAMERA" />
Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Efan Du
  • 123
  • 2
  • 4
  • 14
  • 2
    Please provide a [mcve] showing how you "take a photo" and what your "load function" is. – CommonsWare Sep 11 '17 at 11:34
  • Looks like a caching problem. You probably don't even need to reboot. Just close your app and restart it. It should see the file/s immediately. That's because you probably load the file list BEFORE saving the new files to that folder. Solution: reload the filelist as soon as you save the files. Or, if you're using the system, just force a MediaScanner retrig. – Phantômaxx Sep 11 '17 at 11:34
  • Add other permissions also like READ_INTERNAL_STORAG and WRITE_INTERNAL_STORAGE. – Ankita Sep 11 '17 at 11:38
  • You need to notify the system of the added media. [Look here](https://stackoverflow.com/questions/9414955/trigger-mediascanner-on-specific-path-folder-how-to) on how to do it. – Ch4t4r Sep 11 '17 at 11:56

0 Answers0