2
我仍然在使用下面的代碼,其中我已經給出了一個特定的圖像張貼在牆上每次,但現在我想讓用戶打開手機畫廊和選擇一個圖像,然後張貼到Facebook牆允許用戶打開手機花屏,選擇一個圖像,然後發佈到Facebook牆
請寫一些代碼如何打開畫廊,然後選擇一個圖像發佈,也顯示如何顯示選定的圖像在我的工作代碼,就像我仍然使用這條線:
params.putString("picture",
FacebookUtility.HACK_ICON_URL);
的項目單擊完成代碼:
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());
}
}