什么是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 (将#修改为@)