一般调用系统相机的代码:
filePath = ImageUtil.getCacheFilePath(this, StaticValue.PHOTO_PROTOCOL_ENTRUST); File file = new File(filePath); Intent intentFromCapture = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intentFromCapture.putExtra(MediaStore.EXTRA_OUTPUT, Uri.fromFile(file)); startActivityForResult(intentFromCapture, CAMERA_ENTURST_PHOTO_REQ_CODE);
在OnActivityResult回调的时候发现intetn的data值为null。如果企图通过data取值就会崩溃,
查看相关资料,Android调用相机相关源码:
得出在手动指定了uri之后,data就会为空。
- // First handle the no crop case -- just return the value. If the
- // caller specifies a "save uri" then write the data to it's