我使用以下代码将图像共享到Facebook,但它不起作用。
Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");
share.putExtra(Intent.EXTRA_STREAM,
Uri.parse("/sdcard/img1.png"));
startActivity(Intent.createChooser(share, "Share Image"));
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"));
第一,它应该按这个顺序,只是出于可读性和感官原因
你需要说出错误是什么...
切勿对图像的路径进行硬编码 '/sdcard/img1.png' 改用 getExternalStorageDirectory()