Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a camera intent to capture images for an application.It saves images on tick click. But on cross button click a image is also saved.

How to delete a photo from camera intent in android?

Please help me with a code snippet.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
317 views
Welcome To Ask or Share your Answers For Others

1 Answer

How to delete a photo from camera intent in android?

If you supplied EXTRA_OUTPUT in the ACTION_IMAGE_CAPTURE Intent, see if there is an image written to the location that you specified. If so, delete it.

You can also see if the Intent delivered to onActivityResult() contains a Uri. It is not supposed to, but some buggy camera apps put one there. If it does, and it has a file scheme, you could try deleting the underlying file.

Beyond that, the behavior of the user's chosen camera app is up to the developers of that camera app, not you. If you want that control, write your own camera code, using the camera APIs directly (e.g., android.hardware.Camera, android.hardware.camera2.*) or via wrapper libraries (e.g., Fotoapparat, CameraKit-Android).


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...