美文网首页
Android 7.0 调用照相机照相报错 FileUriExp

Android 7.0 调用照相机照相报错 FileUriExp

作者: 煎鸡蛋彡 | 来源:发表于2017-11-29 09:13 被阅读0次

Intent intent =newIntent(MediaStore.ACTION_IMAGE_CAPTURE);

Uri mImageCaptureUri;

if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {//如果是7.0android系统

ContentValues contentValues =newContentValues(1);

contentValues.put(MediaStore.Images.Media.DATA,newFile(photoPath, imageFileName).getAbsolutePath());

mImageCaptureUri= getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,contentValues);

}else{

mImageCaptureUri = Uri.fromFile(newFile(photoPath, imageFileName));

}

intent.putExtra(MediaStore.EXTRA_OUTPUT, mImageCaptureUri);

startActivityForResult(intent, REQUEST_PICK_FROM_CAMERA);

————————————————————————————————————

原文:http://blog.csdn.net/zuiaisha1/article/details/54986523

相关文章

网友评论

      本文标题:Android 7.0 调用照相机照相报错 FileUriExp

      本文链接:https://www.haomeiwen.com/subject/iszybxtx.html