安卓推迟到相机推迟到、相机

由网友(厌与深情)分享简介:有没有一种方法,从我自己的应用程序,打开默认的摄像头应用程序,并使用的是的得到的图片/视频?我一直在试图寻找它,但我只找到克隆相机应用自己(通常是非常糟糕的指令)指令。我知道这可能与iPhone来完成,我会感到惊讶,如果这是不可能与Android。Is there a way, from within my own...

有没有一种方法,从我自己的应用程序,打开默认的摄像头应用程序,并使用的是的得到的图片/视频?我一直在试图寻找它,但我只找到克隆相机应用自己(通常是非常糟糕的指令)指令。我知道这可能与iPhone来完成,我会感到惊讶,如果这是不可能与Android。

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.

推荐答案

要获得相机拍照,然后得到它只是把使用下面的图片

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);
    }
}
阅读全文

相关推荐

最新文章