我仍然在使用下面的代码,其中我每次都给了一个特定的图像在墙上发布,但现在我想允许用户打开电话库并选择一个图像,然后发布到 facebook 墙上
请编写一些代码如何打开画廊,然后选择要发布的图像,并显示如何在我的工作代码中显示选定的图像,就像我仍在使用这一行一样:
params.putString("picture",
FacebookUtility.HACK_ICON_URL);
ItemClick 的完整代码:
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.XXX.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());
}
}