如何使用facebook sdk在android中发送消息到feed对话框 [英] How to send message to feed dialog using facebook sdk in android

查看:201
本文介绍了如何使用facebook sdk在android中发送消息到feed对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个应用程序来分享一些东西给Facebook。在这里,当我点击一个按钮,feed对话框将来共享,有一个文本框添加消息,我的需要是,我需要从我的代码发送一个数据到文本框。如何发送?

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();

    }


推荐答案

指定Feed对话框的用户消息。 名称,标题和描述字段仅适用于正在共享的链接。

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.

这是设计的。

这篇关于如何使用facebook sdk在android中发送消息到feed对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆