2

我正在使用适用于 Android 的 FB API 3.0,并根据我使用的 Session 示例

Request request = Request.newUploadPhotoRequest(Session.getActiveSession(), image, new Request.Callback();

上传图片。我需要在这张图片中添加一些默认文本,但我不知道该放在哪里。

在旧 API 中,发送了一组参数:

params.putByteArray("picture", imgData);
params.putString(Facebook.TOKEN, accessToken);
params.putString("caption", MyGlobals.INSTANCE.activeSetting.f_name);

将文本添加到请求 newUploadPhotoRequest 的正确方法是什么?

tnx。

4

2 回答 2

7

在创建请求之后执行它之前,您可以执行以下操作:

// Get the current parameters for the request
Bundle params = request.getParameters();
// Add the parameters you want, the caption in this case
params.putString("name", "My Caption String");
// Update the request parameters
request.setParameters(params);

// Execute the request
Request.executeBatchAsync(request);
于 2012-10-26T15:55:31.263 回答
1

使用上述解决方案,我们无法向图像添加描述。

解决方案:

替换namemessage因为:

params.putString("name", "My Caption String");

putString第一个参数是键,因为My caption String该键是唯一的,唯一的被视为message

于 2013-04-03T12:04:28.240 回答