1

I noticed something odd with the way Galaxy Nexus handles photos and file directories. I create them but Android (4.2.2) does not know they exist until you reboot. Well at least on my Nexus 4. I am creating an app and when taking a photo and storing it in Pictures it does not show on Gallery or even show up on my file explorer when you connect your phone to the computer. But when using a file explorer on the phone it finds it. When I reboot my phone it also appears. Is this specific to stock Android? I am making this assumption as it does not happen on my friend's Galaxy S3. So leading to my actual question, is there a way to force Android to re-index the files to update the info without rebooting?

Andy
  • 10,553
  • 21
  • 75
  • 125
  • I used this application when updating music on my phone: https://play.google.com/store/apps/details?id=com.bero.sdrescan&hl=en – Jared Burrows Apr 15 '13 at 05:55

2 Answers2

3

add this code after save photos in SD gallery..

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
        Uri.parse("file://" + Environment.getExternalStorageDirectory())));
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
  • Thanks a lot for the quick response. I had no idea about that technique. Will be very helpful in the future. – Andy Apr 15 '13 at 06:10
1

use

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED,
 Uri.parse("file://" +  Environment.getExternalStorageDirectory())));

hope you have used this:

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177