我正尝试使用此方法发送到已连接的用户墙信息
public static void publishFeedDialog(final Context mContext) {
Bundle params = new Bundle();
params.putString("name", "something");
Bitmap bitmap = BitmapFactory.decodeResource(mContext.getResources(),
R.drawable.icon);
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] bitMapData = stream.toByteArray();
params.putByteArray("picture", bitMapData);
WallPostListener());
WebDialog feedDialog = (
new WebDialog.FeedDialogBuilder(mContext,
Session.getActiveSession(),
params))
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values,
FacebookException error) {
if (error == null) {
// When the story is posted, echo the success
// and the post Id.
final String postId = values.getString("post_id");
if (postId != null) {
Toast.makeText(mContext,
"Posted story, id: "+postId,
Toast.LENGTH_SHORT).show();
} else {
// User clicked the Cancel button
Toast.makeText(mContext.getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
}
} else if (error instanceof FacebookOperationCanceledException) {
// User clicked the "x" button
Toast.makeText(mContext.getApplicationContext(),
"Publish cancelled",
Toast.LENGTH_SHORT).show();
} else {
// Generic, ex: network error
Toast.makeText(mContext.getApplicationContext(),
"Error posting story",
Toast.LENGTH_SHORT).show();
}
}
})
.build();
feedDialog.show();
}}
放置图像的最佳和快捷方式是什么?
在这种方法中我没看到帖子上的图片。
我怎么把图像?我可以在发布之前避免对话吗?
答案 0 :(得分:0)
在此您将找到墙贴的每种方法。 使用Image,ImageURL,Status等。
答案 1 :(得分:0)
使用face book sdk 3.0
并将该图像更改为字符串.. 并使用此代码
params.putString(“picture”,“ur image string”);