【发布时间】:2014-07-12 05:23:06
【问题描述】:
我正在使用 ACTION_SEND 在 facebook 上分享图片,但它不起作用。代码在这里
try {
File myFile = new File("/mnt/sdcard/DCIM/100MEDIA/aa.jpg");
MimeTypeMap mime = MimeTypeMap.getSingleton();
String ext = myFile.getName().substring(
myFile.getName().lastIndexOf(".") + 1);
String type = mime.getMimeTypeFromExtension(ext);
Intent sharingIntent = new Intent(
"android.intent.action.SEND");
sharingIntent.setType(type);
sharingIntent.putExtra("android.intent.extra.STREAM",
Uri.fromFile(myFile));
startActivity(Intent.createChooser(sharingIntent,
"Share using"));
} catch (Exception e) {
Toast.makeText(getBaseContext(), e.getMessage(),
Toast.LENGTH_SHORT).show();
}
但它给出了错误“无法上传”
我正在使用此链接(“Share Image via android app using ACTION_SEND not working”)
【问题讨论】:
-
尝试使用 .PNG 图像而不是 .JPG 图像。你有吗?
标签: android facebook android-intent