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).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…