我正在创建一个应用程序来分享一些东西到 facebook。在这里,当我单击一个按钮时,提要对话框将用于共享,有一个用于添加消息的文本框,我需要从我的代码向文本框发送数据。我怎样才能发送它?
这是我显示提要对话框的代码。
private void showFeedDialog() {
Bundle postParams = new Bundle();
postParams.putString("description","message from me ");
postParams.putString("link", "https://www.google.com");
WebDialog feedDialog = new WebDialog.FeedDialogBuilder(this, Session.getActiveSession(),postParams)
.setOnCompleteListener(new OnCompleteListener() {
@Override
public void onComplete(Bundle values, FacebookException error) {
if(error==null)
{
final String postId=values.getString("post_id");
if(postId!=null)
Toast.makeText(getApplicationContext(), "Posted Successfully", Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(), "Post canceled", Toast.LENGTH_SHORT).show();
}
else
if(error instanceof FacebookOperationCanceledException)
Toast.makeText(getApplicationContext(), "Publish canceled",Toast.LENGTH_SHORT).show();
else
Toast.makeText(getApplicationContext(), "connection error", Toast.LENGTH_SHORT).show();
}
}).build();
feedDialog.show();
}