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.
Related
I have to create functionality for an application where I have to take pictures and save it to a SQLite database. I have implemented the camera for now using the camera intent in android, but the image gets saved to the gallery. I have read the Camer2 and CamerX API documentation and the image still gets saved to a device folder. Is there any way to avoid this?
You can checkout https://stackoverflow.com/a/64651558/277368 on how to get in-memory image with CameraX. Then you need to serialize the image and save it to SQLite on your own.
i am using the cordova camera plugin and saving images to the gallery/photos so they don't delete as prior to this my photos would be saved to the cache and delete quickly enough.
I attach the images i take and save with camera plugin to an email.
What i do is save the ImageURI from the camera function to localstorage to be called again if i resend the email at a later date.
This method works in the short-term and images attach successfully but not after a few hours.
The imageURI of captured images is usually on the format of cdv_photo_001.jpg for example.
However, the images are saved in photos/gallery and the filenames tend to be normal "IMG_0001.JPG" format and don't attach to the email.
is there a way i can get the actual gallery name while taking a picture.
Ive tried to save the image persistently using some guides but i could never get the moveTo to work.
Anyone any ideas?
Thanks
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);
In my application, I use a GalleryView to display thumbnails. I also have some code to delete a photo. However when I refresh the GalleryView, the thumbnail for the deleted photo is still there. Aside from refreshing the sd card, its there a easy way to delete the thumbnail?
show code for the delete - Gallery tries to pick up pictures so unless the delete is working correctly that may be where the failed-delete is
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.