Search code examples
androidandroid-cameraandroid-camera-intent

How to close INTENT_ACTION_STILL_IMAGE_CAMERA activity?


I'm trying to capture multiple photos by using INTENT_ACTION_STILL_IMAGE_CAMERA intent. And after I take multiple photos, the only way that I found to call onActivityResult method is clicking on the phone back button. Is there any way to end the camera activity by defining a custom button?


Solution

  • I'm trying to capture multiple photos by using INTENT_ACTION_STILL_IMAGE_CAMERA intent.

    There is no requirement for the user's chosen camera app to allow the user to capture multiple photos when launched with this Intent.

    Moreover, this Intent action is designed simply for you to bring up a camera app for still photos. In particular, there is no requirement for the app to put the images anywhere that your app can access them or otherwise return any information to your app.

    And after I take multiple photos, the only way that I found to call onActivityResult method is clicking on the phone back button.

    INTENT_ACTION_STILL_IMAGE_CAMERA is not designed for startActivityForResult().

    Is there any way to end the camera activity by defining a custom button?

    Only if you write your own camera activity, such as by using the CameraX library.

    Otherwise, you do not have control over the UI or behavior of the thousands of camera apps that might respond to that Intent action.