显示Facebook共享对话框 [英] Show facebook share dialog

查看:253
本文介绍了显示Facebook共享对话框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我目前的工作在Facebook上共享。我已经成功地发布特别PARAMS但是Facebook的我所做的是将它张贴,甚至没有显示将会后的样子..我正打算以显示每股对话,但我不能似乎找到我如何能很好的指导实现它。

hi i am currently working on facebook sharing. i already have succeeded in posting particular params to facebook however what i did is to post it without even showing what will the post look like.. i was planning to show a share dialog but i cant seem to find a good guide on how i can implement it..

这是我如何上传

public void loginAndPostToWall(){
         facebook.authorize(this, PERMISSIONS, Facebook.FORCE_DIALOG_AUTH, new LoginDialogListener());
    }

    public void postToWall(String message){
        Bundle parameters = new Bundle();
                parameters.putString("message", "message");
                parameters.putString("link", "www.example.com");
                parameters.putString("name", "my name");
                parameters.putString("description", "Try me!");
                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 Wall");
            }
            finish();
        } catch (Exception e) {
            showToast("Failed to post to wall!");
            Log.v("hey", "exception:" + e);
            e.printStackTrace();
            finish();
        }
    }

任何提示或导会做..谢谢

any hints or guides will do.. thank you

推荐答案

下面的方法将简单地张贴到这样的墙:

The following method will simply post to the wall like this:

张贴到墙上之前,它会问什么是你心目中发布前。您可以在输入一些文字,然后发布。这是工作完美的我。

Before posting to the wall, it will ask "What is in your mind" before posting. You can enter some text in that and then post. This is working perfectly for me.

public void SharetoWall() {
            Bundle params = new Bundle();
            params.putString("name", "test title");
            params.putString("description", "test desc");       
            params.putString("link", "some url");
            try{

                params.putString("picture", valuesProductImages.get(0));

            }catch(Exception e){

            }

            facebook.dialog(getParent(), "feed", params, new DialogListener() {

                public void onFacebookError(FacebookError e) {

                }

                public void onError(DialogError e) {

                }

                public void onComplete(Bundle values) {

                }

                public void onCancel() {

                }
            });

        }

这篇关于显示Facebook共享对话框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆