Thumbnail location of Images/Videos in sdcard - android

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 )

Related

Android: Hide JPEGs from Gallery App

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?

Tracking an image after adding to media scanner (when an user selects it from the gallery)

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.

How to avoid saving picture at gallery or delete it automatically in Android?

The device is Samsung Galaxy III. I developed an APP to run the camera activity and capture an image. After analyzing the image, I print out some text information. Right now every captured image is saved at gallery. I don't need the image to be saved in gallery or SD card. I think either of the following two solutions will work for me, but I don't know how to program it:
avoid saving pictures to gallery.
delete the picture somewhere in the APP.
Any comments are appreciated.
Read Android Camera tutorial.
...
Storage - Are the images or videos your application generates intended to be only visible to your application or shared so that other applications such as Gallery or other media and social apps can use them? Do you want the pictures and videos to be available even if your application is uninstalled? Check out the Saving Media Files section to see how to implement these options.
or see this one: How to save image captured with camera in specific folder.
In the Camera intent when starting, add this:
intent.putExtra(MediaStore.EXTRA_OUTPUT,Uri.fromFile(getTempFile(context)));
I solved my problem with following two steps:
as '#auselen' pointed, save all the images to a specific folder. How to save image captured with camera in specific folder.
delete all the images in that folder somewhere in the APP. How to Delete Image From SDCard in Android
use this for delete a pic
ImgPhoto1.setImageBitmap(null);

How to access gallery folder on an android device

I want to retrieve a video or image from the gallery folder. In my honeycomb tablet I don't have a sdcard. Can anybody tell me how to retrieve the image or video in android?
Thanks
Use the MediaStore content provider to find indexed media on the device. The Gallery application, for example, uses MediaStore -- there is no "gallery folder".

Duplicated thumbnail and some images thumbnails not shown in my android app

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.

Categories

Resources