android – How to take multiple photos before dismissing camera intent?-ThrowExceptions

Exception or error:

I am trying to take multiple photos using the default device camera application launched through an intent (MediaStore.ACTION_IMAGE_CAPTURE). With the devices I am testing with, the camera launches, takes a picture, asks for confirmation, then returns to my activity where I process the result.

I’ve considered using broadcast receiver callbacks or a content observer; however, I cannot find a way to launch the camera and keep it active until the user is finished. If possible, I wish to avoid developing a custom camera application.

The reason I must do this is because users commonly need to take multiple photos in succession, and on some devices the camera start-up time is upwards of 5 seconds, and the users using the software take 10 – 30 photos consecutively; not only that, but they need control over various camera parameters.

Is there a way to launch the camera intent and only return to my activity once the user exits the camera application?

How to solve:

I discovered through the SDK documentation that there’s an alternative intent action for the device camera that launches the camera in still image mode and does not exit until the user is finished with the activity:

Intent intent = new Intent(
    MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
this.startActivity(intent);

Coupled with a ContentObserver this was exactly what I needed to accomplish.

Leave a Reply

Your email address will not be published. Required fields are marked *