微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

什么是Android中的FileUriExposedException

如何解决什么是Android中的FileUriExposedException

我正在创建一个应用程序,我们可以在其中共享 imageview 中的图像。我正在使用以下代码

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(file));
intent.setType("image/png");
intent.setFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(intent);

我收到了 FileUriExposedException。那是什么,为什么 Uri.fromFile(file) 不起作用?

顺便说一句,file 此处是存储在手机内存中的 imageview 中的图像

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。