Android7.0中调用系统打开图片报FileUriExposedException
来源:互联网 发布:中国核心期刊数据库 编辑:程序博客网 时间:2024/05/16 09:10
调用系统打开图片
Intent intent = new Intent();File file = new File(fileName);intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);intent.setAction(Intent.ACTION_VIEW);String type = ImageUtils.getMIMEType(file);//设置intent的data和Type属性。intent.setDataAndType(Uri.fromFile(file), type);
报异常:FileUriExposedException
解决办法:
在自定义的Application的onCreate方法中添加如下代码:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder(); StrictMode.setVmPolicy(builder.build());}详情参考:http://blog.csdn.net/xiaoyu940601/article/details/54406725
阅读全文
0 0
- Android7.0中调用系统打开图片报FileUriExposedException
- android7.0打开相册报FileUriExposedException异常
- Android7.0系统中在app内部安装apk时失败或者报错FileUriExposedException
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- 解决Android7.0系统 调用系统相机、系统播放器播放视频、切图兼容问题,报异常android.os.FileUriExposedException
- Android7.0调用系统相机或相册时报错android.os.FileUriExposedException
- Android7.0 FileUriExposedException
- FileUriExposedException,android7.0
- Android7.0异常:FileUriExposedException
- Android7.0打开本地文件失败 android.os.FileUriExposedException
- 解决android7.0报错:android.os.FileUriExposedException
- Android7.0中尝试传递 file:// URI 会触发 FileUriExposedException
- Android7.0拍照失败FileUriExposedException
- Android7.0 android.os.FileUriExposedException
- Android7.0 使用系统相册打开指定图片
- Android7.0调用系统相机拍照、相册选择图片、裁剪
- Android7.0文件共享问题(FileUriExposedException)
- 分布式系统的Quorum策略
- 【分布式】分布式事务的一种实现方式--状态流转
- killoffer-001
- sdut 2099 小型Basic编译器问题
- CloudWatch Examples
- Android7.0中调用系统打开图片报FileUriExposedException
- SVN里常见的图标及其含义
- git-
- 深度学习提速280%!阿里云性能怪兽GN6 V100 GPU实例深度测试
- JS数据类型以及类型转换
- 小米手机调试总出现“INSTALL_CANCELED_BY_USER”
- beagelBone 烧写系统 以及 直接用usb访问网络的方法
- 混合开发(一)Ionic环境搭建
- mongodb入门