1
我想通过我的Android应用程序在Facebook上分享图像位图。我尝试了一些谷歌代码,但无法取得成功,这里是我的代码如何在Android上分享图片在Facebook上的位图?
shareButton = (ShareButton) findViewById(R.id.share_btn);
//share dialog
AlertDialog.Builder shareDialog = new AlertDialog.Builder(this);
shareDialog.setTitle("Share Miimoji");
shareDialog.setMessage("Share Miimoji to Facebook?");
shareDialog.setPositiveButton("Yes", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
//share the image to Facebook
ByteArrayOutputStream baos = new ByteArrayOutputStream();
mSelectedMiimoji.GetBitmap().compress(Bitmap.CompressFormat.PNG, 20, baos);
SharePhoto photo = new SharePhoto.Builder().setBitmap(mSelectedMiimoji.GetBitmap()).build();
SharePhotoContent content = new SharePhotoContent.Builder().addPhoto(photo).build();
shareButton.setShareContent(content);
counter = 1;
shareButton.performClick();
}
});
shareDialog.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
shareDialog.show();
请帮我。 在此先感谢。
'试图在Facebook上共享的图像的位图'。不要尝试。 Facebook无法处理该位图。如果您需要帮助,请不要事先感谢。 – greenapps