使用操作的Andr​​oid应用程序分享的图像发送意图它不工作:( [英] share image from android app using action send with intent it's not work :(

查看:207
本文介绍了使用操作的Andr​​oid应用程序分享的图像发送意图它不工作:(的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是用

Intent sharingIntent = new Intent(Intent.ACTION_SEND);

Uri screenshotUri = Uri.parse("file//res/drawable/u.png");
 

sharingIntent.setType("image/png");


sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);


startActivity(Intent.createChooser(sharingIntent, "Share image using"));

//我用三星真正的device.and我选择Facebook分享。 //但是内容是空的不是我的图像共享我不能共享图像。

//I use sumsung real for device.and i choose share on facebook. //But content is empty not my image to shared i can't shared image.

这是故意的动作发送不使用Facebook SDK。 你能帮助我吗?

This is intent action send isn't use facebook sdk. can you help me please?

推荐答案

您打算错误的方式来访问文件夹可绘制对象使用这种方式。

You are going to wrong way to Access Drawable folder use this Way.

Uri imageUri = Uri.parse("android.resource://your.package/drawable/fileName");

您应该尝试这种方式:

      Uri imageUri = Uri.parse("android.resource://your.package/drawable/fileName");
      Intent intent = new Intent(Intent.ACTION_SEND);
      intent.setType("image/png");

      intent.putExtra(Intent.EXTRA_STREAM, imageUri);
      startActivity(Intent.createChooser(intent , "Share"));

这篇关于使用操作的Andr​​oid应用程序分享的图像发送意图它不工作:(的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆