Reputation: 6179
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");
Upvotes: 0
Views: 76
Reputation: 26
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())));
Upvotes: 1