0
我“米试图发送到连接的用户墙饲料用这种方法如何墙上饲料在Android
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();
}}
的是把形象的最佳和快速的方式?
发送至Facebook与图像在此方法中我没有看到有关的帖子图片。
我如何把图像?我能避免发布前的对话框?
“图像字符串” - 那是什么? –