Instagram 分享问题:我总是收到“无法加载图片”的消息

Instagram sharing issue: Always I get the message “Unable to load image”

我正在开发共享功能

我的 Instagram 分享有问题

这是我的代码:

如何解决这个问题?

你不能直接共享drawable

首先从 drawable 创建一个文件然后分享它

Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/jpg");
File image = new File(getFilesDir(), "foo.jpg");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(image));
startActivity(Intent.createChooser(shareIntent, "Share image via"));