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
网友评论