Facebook提要对话框中的一个android

时间:2011-07-22 09:21:25

标签: android facebook-graph-api

我将图片网址http://graph.facebook.com/User_Id/picture作为Facebook提要对话框的参数,其中user_id是facebook上特定用户的用户名。但它在Android上显示错误“Facebook流中不允许FBCDN图像”。所以,任何人都知道如何从Facebook上的个人资料中提供照片???

此外如何使这张图片附加到一个链接,在Facebook上打开特定的用户个人资料或将此图片链接到任何网址????

以下是我用来向Facebook提要对话框提供参数的代码。

//Giving the params to feed dialog
Bundle params = new Bundle();
params.putString("message", facebookMessage);
params.putString("link", ComLabelConstants.FACEBOOK_LINK);
params.putString("name", linkname);
params.putString("picture", "http://graph.facebook.com/XXXX/picture");
params.putString("caption", ComLabelConstants.FACEBOOK_LINK_CAPTION);
params.putString("description", "This is description");

// displaying facebook dialogs
mFacebook.dialog(FbookAlertBoxActivity.this, "feed", params,
    new SampleDialogListener(this, mAsyncRunner));

1 个答案:

答案 0 :(得分:0)

据我所研究... facebook不允许将其域名图片通过帖子张贴在墙上。所以,我们不能使用它。现在我正在做的是通过以下代码获取图片:

ImageView user_picture;
        user_picture = (ImageView) findViewById(R.id.user_picture);
        URL img_value = null;
        Bitmap mIcon1 = null;
        try {
            img_value = new URL("http://graph.facebook.com/XXXX/picture");
            try {
                mIcon1 = BitmapFactory.decodeStream(img_value
                        .openConnection().getInputStream());
            } catch (IOException e) {
                // TODO Auto-generated catch block 
                e.printStackTrace();
            }
        } catch (MalformedURLException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
        if(mIcon1!=null){
            user_picture.setImageBitmap(mIcon1);
        }

如果要将其转换为字节数组

        ByteArrayOutputStream baos = new ByteArrayOutputStream();   
        mIcon1.compress(Bitmap.CompressFormat.PNG, 100, baos);    
        b = baos.toByteArray(); 

将此图像发送到我的服务器,然后发布到墙上。