【发布时间】:2014-12-23 18:23:19
【问题描述】:
我目前使用这种方法可以有效地将图像文件转换为内容uri...
protected static Uri convertFileToContentUri(Context context, File file) throws Exception {
ContentResolver cr = context.getContentResolver();
String imagePath = file.getAbsolutePath();
String imageName = null;
String imageDescription = null;
String uriString = MediaStore.Images.Media.insertImage(cr, imagePath, imageName, imageDescription);
return Uri.parse(uriString); }
...但问题是它需要android.permission.WRITE_EXTERNAL_STORAGE 权限。
有没有什么方法可以在不需要该权限的情况下执行相同的转换?
【问题讨论】:
标签: android android-contentresolver