0

I am working on an app that uses the camera to take a picture and stores that picture on the SD Card. The problem is that after I take a save a picture, I have to unmount and remount the SD Card before I can see the picture in the Gallery app.

Should I unmount and remount the SD Card via my app, every time the user takes a picture? Is there a better solution to this?

Chris
  • 5,485
  • 15
  • 68
  • 130

1 Answers1

0

You can't mount/unmount the SD card (external storage) from an app. You probably need to call media scanner to get your picture indexed. Look at here and here for pointers. There is also an sample app that comes with the SDK. BTW, what Android version are you testing on?

Nikolay Elenkov
  • 52,576
  • 10
  • 84
  • 84
  • The phone is running Android v2.3.4 – Chris May 09 '12 at 17:11
  • OK. On 2.x you should be able to see the actual file without scanning, but the gallery may not pick it up right away. Does calling the media scanner change anything? – Nikolay Elenkov May 10 '12 at 01:01
  • I won't be able to look at this again until next week. I will report back then. – Chris May 10 '12 at 14:52
  • I followed the code here: http://stackoverflow.com/questions/5250515/how-to-update-the-android-media-database – Chris Jun 10 '12 at 19:20
  • Yes, that's certainly works, but it will force a scan of the whole SD card/external storage directory. And since that's a system intent, it may or may not work in future versions. – Nikolay Elenkov Jun 11 '12 at 00:47