无法将文字发布到fb wall

时间:2015-12-29 10:17:25

标签: android facebook facebook-graph-api

我无法使用此代码发布fb.getting null in response.after auth login。

     public void postToWall(String message) {

        Bundle parameters = new Bundle();
        parameters.putString("message", message);
        parameters.putString("description", "topic share");
        try {
            facebook.request("me");
            String response = facebook.request("me/feed", parameters, "POST");

            Log.d("Tests", "got response: " + response);
            if (response == null || response.equals("")
                    || response.equals("false")) {
                showToast("Blank response.");
            } else {
                showToast("Message posted to your facebook wall!");
            }
        } catch (Exception e) {
            showToast("Failed to post to wall!"+e.getCause()+e.getMessage());
            e.printStackTrace();
        }
    }

1 个答案:

答案 0 :(得分:0)

试试这个:

  Bundle parameters = new Bundle();

          parameters.putString("link", "http://www.google.co/");
          parameters.putString("caption","message");
    facebook.dialog(this, "feed", parameters,new DialogListener() {

        @Override
        public void onFacebookError(FacebookError e) { 
            // TODO Auto-generated method stub

        }

        @Override
        public void onError(DialogError e) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onComplete(Bundle values) {
            // TODO Auto-generated method stub

        }

        @Override
        public void onCancel() {
            // TODO Auto-generated method stub

        }
    });