从Android应用程序分享到Facebook的链接,不带图像

时间:2013-04-06 09:48:46

标签: android

使用以下代码将图片和网址发布到Facebook墙上

          private void postToWall() {
    if (facebook != null) {
        if (facebook.isSessionValid()) {
            Bundle b = new Bundle();
            b.putString("picture", "imageurl");

            b.putString("caption", "Testing");
            b.putString("description", "Testing in android");
            b.putString("name", "naveen");

            b.putString("link", "http://funmango.com/");
            try {
                String strRet = "";
                strRet = facebook.request("/me/feed", b, "POST");
                JSONObject json;
                try {
                    json = Util.parseJson(strRet);
                    if (!json.isNull("id")) {
                        Log.i("Facebook", "Image link submitted.");
                    } else {
                        Log.e("Facebook", "Error: " + strRet);
                    }
                } catch (FacebookError e) {
                    Log.e("Facebook", "Error: " + e.getMessage());
                }
            } catch (Exception e) {
                Log.e("Facebook", "Error: " + e.getMessage());
            }
        }
    }
}

但我的要求是,如果没有图像,我只想发布文字并链接到墙,

提前致谢

0 个答案:

没有答案