Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/facebook/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用Android在Facebook好友的墙上发布图片_Facebook_Facebook Graph Api - Fatal编程技术网

如何使用Android在Facebook好友的墙上发布图片

如何使用Android在Facebook好友的墙上发布图片,facebook,facebook-graph-api,Facebook,Facebook Graph Api,我已经开发了一个应用程序,我允许用户在朋友的墙上张贴一张图片,在这里我只给出了一张静态图片,使用下面的代码 params.putString("picture", FacebookUtility.HACK_ICON_URL); 其中HACK_图标_URL It is the URL of an Image... 但现在我想让用户从多张图片中选择一张图片,然后贴在朋友的墙上 FriendsList.java: public void onItemClick(Adapter

我已经开发了一个应用程序,我允许用户在朋友的墙上张贴一张图片,在这里我只给出了一张静态图片,使用下面的代码

    params.putString("picture", FacebookUtility.HACK_ICON_URL);
其中HACK_图标_URL

    It is the URL of an Image...
但现在我想让用户从多张图片中选择一张图片,然后贴在朋友的墙上

FriendsList.java:

   public void onItemClick(AdapterView<?> adapterView, View view,
        int position, long id) {

    try {
        final long friendId;
        friendId = jsonArray.getJSONObject(position).getLong("uid");
        String name = jsonArray.getJSONObject(position).getString("name");
        new AlertDialog.Builder(this)
                .setTitle(R.string.post_on_wall_title)
                .setMessage(
                        String.format(getString(R.string.post_on_wall),
                                name))
                .setPositiveButton(R.string.yes,
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog,
                                    int which) {
                                Bundle params = new Bundle();

                                params.putString("to",
                                        String.valueOf(friendId));
                                params.putString("caption",
                                        getString(R.string.app_name));
                                params.putString("description",
                                        getString(R.string.app_desc));
                                params.putString("link", "http://www.google.com");
                                params.putString("picture",
                                        FacebookUtility.HACK_ICON_URL);
                                params.putString("name",
                                        getString(R.string.app_action));
                                FacebookUtility.facebook
                                        .dialog(FriendsList.this,
                                                "feed",
                                                params,
                                                (DialogListener) new PostDialogListener());
                            }

                        }).setNegativeButton(R.string.no, null).show();
    } catch (JSONException e) {
        showToast("Error: " + e.getMessage());
    }
}

public class PostDialogListener extends BaseDialogListener {
    @Override
    public void onComplete(Bundle values) {
        final String postId = values.getString("post_id");
        if (postId != null) {
            showToast("Message posted on the wall.");
        } else {
            showToast("No message posted on the wall.");
        }
    }
}