如何在android facebook墙上发帖子?

时间:2014-12-09 05:31:13

标签: android facebook-graph-api

我正在使用此代码在android facebookwall上发布

Bundle parameters = new Bundle();


parameters.putString("message", string);
    try {
        mFacebook.request("me");
        mFacebook.request("feed", parameters, "POST");
        Toast.makeText(MainActivity.this,
                "Message posted to your facebook wall!", Toast.LENGTH_SHORT)
                .show();
    } catch (Exception e) {

        e.printStackTrace();

    }

但发布时我收到此错误。

    Key format expected byte[] but value was a java.lang.String.  The default value <null> was      
    returned.
    Attempt to cast generated internal exception:
   // class cast exceptions
    java.lang.ClassCastException: java.lang.String cannot be cast to byte[]
    at android.os.Bundle.getByteArray(Bundle.java:1411)
    at com.facebook.android.Util.encodePostBody(Util.java:63)
    at com.facebook.android.Util.openUrl(Util.java:182)
    at com.facebook.android.Facebook.request(Facebook.java:559)
    at com.facebook.android.AsyncFacebookRunner$2.run(AsyncFacebookRunner.java:208)

1 个答案:

答案 0 :(得分:0)

尝试这个参数.putString(&#34;消息&#34;,&#34;写你的帖子在墙上显示&#34;);