I used the MediaStore.images.thumbnail.external_content_uri to query the thumbnail on the phone. It works ok with my new phone with some photos taken from camera or the download images from browser.
When using it one friends phone, there are some thumbnails duplicated shown on the gridview and some not even shown.
Do I need to rescan the media before querying the thumbnails in the mediastore.
My experience in working with MediaStore.images.thumbnail is that it cannot be trusted. I guess this is due to different implementation of phone vendors. For example, on my HTC, the thumbnails of gallery is cached by itself (since it is not standard size), not via MediaStore, so those entries are absent in MediaStore. (PS, entries in MediaStore.images.thumbnail are not essentially mapped to an existing picture, that means, it may have an entry on Picture A, if later on you removed Picture A, the thumbnail could still be there pointing to nothing)
The more reliable way is to query the ID of Images from MediaStore.images, and then use MediaStore.images.thumbnails.getThumbnail to retrieve the Image with the IDs.
Related
Working on an Android app that downloads images in JPEG format internally and then displays them within the app.
The issue is that the default Gallery App, shows those images as it scans entire storage for JPEG or PNG files. That causes confusion w/ some users as they do not expect to see internal app images next to their family photos.
My initial thoughts are to rename the extension. But before that, does anyone know if perhaps a simpler way exists by using permissions?
I have an app that allows users to take images from their camera that get saved to the SD card and I run the media scanner on it so they are visible in the gallery. Users can also add images from the gallery.
I do some compression on the image before saving to SD card. So, when a user selects an image from gallery, if it was an image that was compressed and written by my app, I want to avoid it from getting compressed again. I was thinking of checking the image path to figure out if the image was from my app, but with URIs, I get strings like content://com.android.providers.media.documents/document/image%3A38691 and uri.getPath() doesn't seem to have the path.
What are my options to figure out if this image was from my app? Here are the things I can think of:
1) Uri uri = Uri.fromFile(file): This seems to be giving a value of file:///storage/emulated/0/Pictures/MyApp/image.jpg
2) Store a checksum of the data when I write to the SD card and check against this when I see the new image.
3) Somehow get the URI when the media scanner is run. Haven't figured out how to do this yet.
UPDATE: for option (3), looks like I can use a MediaScannerConnectionClient. Is this the best option? Store the path to URI mapping in a DB and refer to that each time the user adds a new image to my app from the gallery.
I am working on an Android app where I have customized the camera. Now I want to delete all the images from the gallery that have been clicked once they have been uploaded in the server. This has been done successfully. However I am not sure whether they are retained in Android's own database. Can anyone please tell me how to see if the image data are saved anywhere in Android's own database once they have been deleted from the picture gallery as I need to take care of this as well.
I have a large amount of online images stored on my server. I have created a small java server backend to provide album lists and images per album, including a small management console.
I want to use/view these images on my Android device, by using the standard photo/gallery application. Apps like Google Picasa and Facebook do the same thing.
Eg. When I open up the gallery app, there's a tab called "Albums" where a number of folders are visible, including Picasa/Facebook. Most of these folders can be found on my SD card, but the albums by Picasa/Facebook are only online. Entering these online albums clearly shows the "album structure" you have with that provider ("Profile Pictures" at Facebook for instance).
The question:
How did Picasa/Facebook end up there, and how can I recreate said functionality?
I am almost certain it is done using Content Providers, but I can't even find a simple example when used for images. And unfortunatly, most answers here are providing solutions to the wrong problem.
The secondary question: Would this also be possible with Android's Movie and Music players?
I would like to know the location of the stored thumbnails in android sdcard. I used the adb push service to upload images and videos to the sdcard. But even after deleting few images, my application is loading the thumbnails of the deleted images which is creating problems. When I click the thumbnails, instead of the corresponding image, some other image is opening. How to delete/ re-populate the thumbnails? Also How to load the original image of the clicked thumbnail? How does android retrieve the original image corresponding to its thumbnail? what's the mapping between these two?
Thanks in advance.
Well, if you are are using system intents, like ACTION_PICK, then you probably need run media scanner ( Applications > Dev Tools > Media Scanner )