Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between REQUEST_TAKE_PHOTO and REQUEST_IMAGE_CAPTURE

Tags:

android

I read the developer docs on how to use existing Camera software on the device to take a picture and return to the app here and I was confused by the fact that when simply grabbing a thumbnail, they use the following intent code

startActivityForResult(takePictureIntent, REQUEST_IMAGE_CAPTURE);

however, when taking a picture and saving the full file, they use:

startActivityForResult(takePictureIntent, REQUEST_TAKE_PHOTO);

At least for me, REQUEST_TAKE_PHOTO can not be resolved, and I cant find any reference to it anywhere. Anyone know what the differences are between the two?

like image 322
ardevd Avatar asked Jan 02 '14 14:01

ardevd


People also ask

How do you take multiple pictures on android?

There is nothing extra which you need to do to capture burst shots. Whichever smartphone you are using, just open the in-built camera app. -- Open the camera app, press and keep holding the shutter button. -- This automatically activates the Burst Mode and clicks multiple photos until you release the button.

How do I open my Android camera and gallery?

Run the application on an Android phone. Selecting "Take photo" will open your camera. Finally, the image clicked will be displayed in the ImageView. Selecting "Choose from Gallery" will open your gallery (note that the image captured earlier has been added to the phone gallery).

Which intent action do you use to take a picture with a camera app?

The Android Camera application encodes the photo in the return Intent delivered to onActivityResult() as a small Bitmap in the extras, under the key "data" . The following code retrieves this image and displays it in an ImageView . Note: This thumbnail image from "data" might be good for an icon, but not a lot more.


1 Answers

REQUEST_TAKE_PHOTO can not be resolved

While they have a typo in their source, they do show where they define that integer. Scroll down to the last code snippet in the "Save the Full-Size Photo" section.

Anyone know what the differences are between the two?

In the code presented on that page, there is no difference between the two, as they are both defined to be 1. This is sloppy example. :-(

In general, if one activity calls startActivityForResult() for two or more distinct requests, you will want to use different numeric values for the requestCode. Both results will be delivered to the same onActivityResult() method implementation, and you use the requestCode to distinguish one result from another.

like image 116
CommonsWare Avatar answered Sep 21 '22 23:09

CommonsWare