I use the standard TTakePhotoFromCameraAction in my application in order to take a photo.
What I would like to do, is when the user closes the application and then open it again, the last taken photo to be uploaded.
I know how to use SharedPreference in delphi, but I don't know what is the filename & path of the photo it self!
Any clues?
The TTakePhotoFromCameraAction.OnDidFinishTaking event gives you a Bitmap of the taken photo. It is then your responsibility to save it where and how you need it. TTakePhotoFromCameraAction does not save it for you.
There is a sample showing you how to do it coming with delphi samples:
C:\Users\Public\Documents\RAD Studio\12.0\Samples\FireMonkeyMobile\PhotoEditorDemo
Related
Is it possible to capture a camera image and use it in my code, but not have the image saved on the device? I need the image for sending to an API, but I have no need for the user to have the file afterwards. Can this be done?
This is not a good idea, as there is too much overhead when handling the full size image in RAM.
I would personally just create a scaled down preview to put in UI(if needed), then upload original(saved on SD) image and delete afterwards.
Some devices will force the images into the gallery.
This will help you with said problem
Here is my edited answer in regard to how i would do it.
Save image to disk and ensure it is encoded correctly for the API you are using.
Start upload service when network connection is available (if necessary).
Either delete image from service or schedule an Alarm to start service and deal with it later
if u r using native camera activity
capture the image on file
get the bitmap of the image from the file
delete the file
(u can save the image in hidden directory {{its name should start with dot .hidden_dir/myimg.jpg }} )
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);
i want to know if it's posible to avoid camera intent to saving the pic to the image gallery. i want to add the pic only in the internal storage, so i don't want the pic save twice on my device. Or other thing will be, delete the pic after.
During R&D i found this ,it will defiantly solve your problem.
Deleting a gallery image after camera intent photo taken
I'm developing an application that requires the functionality allowing the user to browse through the Sd card and select an image of his choice as the background for the application.
This image is assumed to be in the sd card. But the name and location(specific) folder is unknown.
I got the code of getting an image to my background. This is the code but here the filename is known in advance. I want the user to select the file he needs.
I also referred to this code but couldn't link the two of them. Can someone provide me with a solution? Thanks in advance..
Before starting the MainActivity, use an another activity in which in onCreate call the ImagePicker Code. After selecting an image, after coming back to onActivityResult, call the mainActivity and pass the Image path with Intents. Then use the as usual code that you have to set it as back ground.
I saved a picture locally through my Air app, but I need to call this MediaScanner to update the gallery,
so that the user could see the saved pic, like this solution :
Updating gallery after taking pictures Gallery not showing all the pictures Android Camera
How do you do it through Air Mobile ?
Is it necessary to create a native extension ?
if so, how ?
Thanks.
The solution is to create a native extension and call it after the saving process is done.
A nice existing extension which refreshes the gallery can be found here :
Fathah's Refresh Gallery ANE