Android使用按钮共享活动图像

时间:2012-07-30 17:54:20

标签: android image button imageview share

我希望用户点击按钮时共享的图像

图像是他使用油漆等许多功能制作的图像。 我希望当他点击共享按钮时共享意图“通过共享”。 出现并让他选择在

分享他希望分享的地方

我找到了这段代码但是从(路径)

收到错误
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse(path);
sharingIntent.setType("image/png");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));

我该怎么做?

1 个答案:

答案 0 :(得分:0)

你在变量路径中放了什么?

Path是您之前保存位图的文件的路径(sdcard或内部应用程序存储)。

首先必须保存图片,但如果你现在不保存,你如何填写路径变量?