0

I'm writing an Android app and I'm trying to save the image to the phone's image gallery. When I step through this code it seems to be running fine and no exceptions are thrown. I simply don't see the downloaded images in my gallery and I can't find them on my emulator.

Why won't the images downloaded with the code below show up in my phone's gallery?

URL imageURL = new URL(photoRequestUrl);
Bitmap imageBitmap = BitmapFactory.decodeStream(imageURL.openStream());

//getContext().
MediaStore.Images.Media.insertImage(getContext().getContentResolver(), imageBitmap, "title" , "description");
Dave
  • 6,141
  • 2
  • 38
  • 65

1 Answers1

1

Maybe you reboot your phone will see the picture in the gallery. Try to write this line after writing some into storage.

sendBroadcast(new Intent(Intent.ACTION_MEDIA_MOUNTED, Uri.parse("file://" + Environment.getExternalStorageDirectory())));
Prashant Kumar
  • 20,069
  • 14
  • 47
  • 63
Light
  • 26
  • 2