拍照后,获取图像的URI onActivityResult? [英] Get image Uri in onActivityResult after taking photo?
本文介绍了拍照后,获取图像的URI onActivityResult?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个code:
startActivityForResult(新意图(MediaStore.ACTION_IMAGE_CAPTURE),CAMERA_IMAGE);
,它允许用户拍摄照片。现在,我怎么会得到 onActivityResult
的的那张照片乌里
?它是一个意图
额外?它是通过 Intent.getData()
?
解决方案
保护无效onActivityResult(INT申请code,INT结果code,意图意图){
乌里U = intent.getData();
}
顺便说一句...有与意图在某些设备上的错误。看看这个答案要懂得变通办法。
I have this code:
startActivityForResult(new Intent(MediaStore.ACTION_IMAGE_CAPTURE), CAMERA_IMAGE);
That allows that user to take a photo. Now how would I get the Uri
of that photo in onActivityResult
? Is it an Intent
extra? Is it through Intent.getData()
?
解决方案
protected void onActivityResult(int requestCode, int resultCode, Intent intent){
Uri u = intent.getData();
}
By the way... there's a bug with that intent in some devices. Take a look at this answer to know how to workaround it.
这篇关于拍照后,获取图像的URI onActivityResult?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文