Is there a way, from within my own application, to open up the default camera app and use that to get a picture/video? I keep trying to look it up but I only ever find instructions on cloning the camera app myself (usually with very bad instructions). I know this can be done with the iPhone, I would be surprised if it wasn't possible with Android.
+1
A:
Here's some sample code where he starts the Camera intent and gets the image taken:
http://www.androidph.com/2008/11/camera-capture.html
(Warning, it's about a year old, so it will need a little updating).
marcc
2009-11-01 16:55:43
+1
A:
Yep, you can. That's one of the ideas behind Android's intents.
Take a look here.
Dimitar Dimitrov
2009-11-01 18:09:59
A:
To get the camera to take a picture and then get the image that it just took use the following
// Call to take the picture using the default camera
startActivityForResult(new Intent("android.media.action.IMAGE_CAPTURE"), PICK_FROM_CAMERA);
// After the camera intent finished returns the uri of the image taken
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data)
{
if (requestCode == PICK_FROM_CAMERA)
{
Uri uri = data.getData();
// set the imageview image via uri
_previewImage.setImageURI(uri);
}
}
Bob.T.Terminal
2009-11-02 14:19:00