通过ShareDialog共享文本存在很大问题。我似乎只能共享预定义的链接,描述......但不能共享文本。有没有其他方法可以从我的Android应用程序分享Facebook的文本。 我的代码是:
FacebookDialog shareDialog = createShareDialogBuilderForLink().build();
private FacebookDialog.ShareDialogBuilder createShareDialogBuilderForLink() {
return new FacebookDialog.ShareDialogBuilder(this)
.setCaption("Here Comes the Boom!!!!")
.setName("Hello Facebook")
.setDescription("Here is my description")
.setLink("http://developers.facebook.com/android");
}
答案 0 :(得分:2)
这是不可能的,你必须使用Facebook api来做到这一点。
答案 1 :(得分:1)
代码 Facebook 分享文字/链接
public void post(String post_text) {
Bundle postParam = new Bundle();
Request.Callback callback = new Request.Callback() {
@Override
public void onCompleted(Response response) {
// shareDialog.dismiss();
// showPublishResult("Photo Post", response.getGraphObject(),
// response.getError());
}
};
Session session = createSession();
postParam.putString("name", post_text);
postParam.putString("link", "https://developers.facebook.com/android");
Request request = new Request(session, "me/feed", postParam,
HttpMethod.POST, callback);
RequestAsyncTask task = new RequestAsyncTask(request);
task.execute();
}