![](/img/trans.png)
[英]i want to share image from my android app on facebook, but not upload this image
[英]i want to add “share the image to Facebook” feature in my android application?
我创建了一个向用户显示图像的应用程序。 用户可以下载图像并将其设置为墙纸,但我希望该用户可以将图像共享到Facebook? 我不知道该怎么做。 谁能帮我?
谢谢
使用Intent
在Facebook中共享您的图像。
Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = null;
if(imageUri!=null){
screenshotUri = Uri.parse(imageUri);
sharingIntent.setType("image/jpeg");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
}
startActivity(Intent.createChooser(sharingIntent, "Share image using..."));
确保您的Image Uri
不为null。 这将启动一个Intent,该Intent将显示您可以与之共享图像的所有应用程序。 其中,Facebook。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.