i am creating an app for share something to facebook. here when i click on a button the feed dialog box will come for sharing, there is a text box for adding message, my need is that i need to send a data to the text box from my code. how can i send it ??
and this is my code to show the feed dialog box.
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();
}
To post message from activity use this
The code for Publishing your Feed using the new Facebook SDK 3.0 is as follows:
You cannot specify a user message to the feed dialog. The "name", "caption", and "description" fields only apply to the "link" that's being shared.
This is by design.