我正在尝试使用此方法发送给连接的用户墙提要
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();
}}
放置图像的最佳和快速方法是什么?
在这种方法中,我在帖子上看不到图片。
我如何放置图像?我可以在发帖前避免对话吗?