user3115201
user3115201

Reputation: 111

How to use camera intent to take photos multiple times

I got a problem similar to (How to take multiple photos before dismissing camera intent?)!

how ever he used the:

Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);

I need to use somewhat like this:

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    for(int i=0;i<2;i++){
        fileUri = getOutputMediaFileUri(MEDIA_TYPE_IMAGE);

        intent.putExtra(MediaStore.EXTRA_OUTPUT, fileUri);

    // start the image capture Intent
        startActivityForResult(intent, CAMERA_CAPTURE_IMAGE_REQUEST_CODE);
   }

since i need to take exactly 2 photos, preview it with the default check or x of using MediaStore.ACTION_IMAGE_CAPTURE(to remove the hassle of displaying it to an imageview, go back again to capture)

then only go back to the main activity, knowing the data that i had taken 2 photos/saved it.

however, when i used that for loop, it returned only the last image taken, and it resized 2 times( i have a code that resizes 25% of the original captured photo, so after the code executed, it resized to 6.25% of original(1/4 of 25%) before it returns to the main activity).

Can someone give me light what is happening and give me a solution? Thanks a lot in advance! :D

As much as possible, i want to use the built in camera app, since it has a lot of other functions readily available compared to having the hassle of building your own custom camera. Btw im using android jellybean. 4.1.1

Upvotes: 0

Views: 4651

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006724

Call your second startActivityForResult() from the onActivityResult() you get from your first startActivityForResult(). Bear in mind that startActivityForResult() is asynchronous -- the other activity is not started right away.

Upvotes: 3

Related Questions