Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android facebook:在对话框中不显示我的消息_Android_Facebook - Fatal编程技术网

android facebook:在对话框中不显示我的消息

android facebook:在对话框中不显示我的消息,android,facebook,Android,Facebook,我正在开发facebook android应用程序,但我面临一个问题 我正在使用以下示例 所以问题是这里的一切都很好,对话框等等,但是当它打开屏幕上传我在这里设置的Walla消息时 try { System.out.println("*** IN TRY ** "); Bundle parameters = new Bundle(); parameters.putString("mes

我正在开发facebook android应用程序,但我面临一个问题

我正在使用以下示例

所以问题是这里的一切都很好,对话框等等,但是当它打开屏幕上传我在这里设置的Walla消息时

        try 
        { 
            System.out.println("*** IN TRY ** ");
            Bundle parameters = new Bundle(); 
            parameters.putString("message", "this is a test");// the message to post to the wall 
            facebookClient.dialog(this, "stream.publish", parameters, this);// "stream.publish" is an API call 
        } 
        catch (Exception e) 
        { 
            // TODO: handle exception 
            System.out.println(e.getMessage()); 
        } 
它不会显示在对话框中写入的消息。那有什么问题

谁能给我指路吗


非常感谢。

消息已被忽略。您可以在此处阅读:

该字段将在2011年7月12日被忽略,该消息将预先填充用户将键入的文本字段。为了符合Facebook平台策略,只有在用户在工作流的早期手动生成内容时,应用程序才能设置此字段。大多数应用程序不应设置此选项


使用此代码,它对我有效:

                    Bundle parameters = new Bundle();
                    parameters.putString("message",sharetext.getText().toString());// the message to post to the wall
                    //facebookClient.dialog(Jams.this, "stream.publish", parameters, this);// "stream.publish" is an API call
                    facebookClient.request("me/feed", parameters, "POST");
希望能有帮助

Edited:



 public class FacebookActivity implements DialogListener
    {

        private Facebook facebookClient;
        private LinearLayout facebookButton;



       public FacebookActivity(Context context) {

           facebookClient = new Facebook();
           // replace APP_API_ID with your own
           facebookClient.authorize(Jams.this, APP_API_ID,
               new String[] {"publish_stream", "read_stream", "offline_access"}, this);

       }

        @Override
        public void onComplete(Bundle values)
        {

            if (values.isEmpty())
            {
                //"skip" clicked ?

            }

            // if facebookClient.authorize(...) was successful, this runs
            // this also runs after successful post
            // after posting, "post_id" is added to the values bundle
            // I use that to differentiate between a call from
            // faceBook.authorize(...) and a call from a successful post
            // is there a better way of doing this?
            if (!values.containsKey("post_id"))
            {
                try
                {
                    Bundle parameters = new Bundle();
                    parameters.putString("message",sharetext.getText().toString());// the 

message to post to the wall
                    //facebookClient.dialog(Jams.this, "stream.publish", parameters, 

this);// "stream.publish" is an API call
                    facebookClient.request("me/feed", parameters, "POST");
                    sharetext.setText("");
                    Toast.makeText(Jams.this,"Message posted 

successfully.",Toast.LENGTH_SHORT).show();

                }
                catch (Exception e)
                {
                    // TODO: handle exception
                   // System.out.println(e.getMessage());
                }

            }

        }

        @Override
        public void onError(DialogError e)
        {       
            return;
        }

        @Override
        public void onFacebookError(FacebookError e)
        {   
            return;
        }

        @Override
        public void onCancel()
        {      
            return;     
        }

    }

嗯,这取决于你的申请。我说不出最好的解决办法。解决方案只是使用message属性以外的内容。一个例子是发布链接并使用name属性。为什么它在发布时总是要求登录,并且可以在墙上发送消息正文,我只能发送linkbuddy它在facebookClient.request行上给我类强制转换异常错误是类强制转换异常java.lang.String。它还表示预期的字节[],但值为java.lang.String。有什么帮助吗???看看我编辑过的全部代码:只需简单地实例化你正在使用的这个类。我使用的是这个,它没有带参数的facebook()构造函数。请更新当您使用“共享文本”时,此墙贴对话框需要由我们自己或其在facebook中的预构建来定义。。你能分享一下你的想法吗?我在使用2012年1月18日最新的SDK时也遇到了同样的问题,我很想知道你是如何解决这个问题的……忽略我之前的评论。从接受的答案来看,您似乎选择使用Facebook
request
方法,而不是Facebook
dialog
方法。