如何获得所捕获的图像的URL? [英] How to get the URL of the captured image?

查看:111
本文介绍了如何获得所捕获的图像的URL?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发起一个活动来捕获照相机的图片:

I launch an activity to capture a picture from camera:

Intent i = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE, null);
i.putExtra("return-data", true);
startActivityForResult(i, PICK_FROM_CAMERA);

你能告诉我怎么去捕捉画面的URI?

Can you please tell me how to get the URI of the capture picture ?

推荐答案

要得到的是刚刚从相机,你会做的图像以下

To get the image that was just taken from the camera you would do the following

// Call to take the picture
startActivityForResult(new Intent("android.media.action.IMAGE_CAPTURE"), PICK_FROM_CAMERA);

@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);
    }
}

这篇关于如何获得所捕获的图像的URL?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆