我想在facebook上发布带有消息和我的应用程序名称的图像。我的帖子必须是这样的:

我已经应用了以下代码
Bitmap bi = BitmapFactory.decodeResource(getResources(), R.drawable.bluerib);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
bi.compress(Bitmap.CompressFormat.JPEG,100, baos);
data = baos.toByteArray();
Bundle params = new Bundle();
params.putByteArray("picture", data);
params.putString("method", messageToPost);
facebook.request("me");
String response = facebook.request("me/photos", params, "POST");我可以成功地在Facebook上发送图像和消息,除了应用程序的名称,但我想在Facebook墙上张贴它,我的照片一定不能保存在Facebook的照片,我想要的完美对齐左侧的图像,然后在顶部的应用程序名称和我的消息。如何做到这一点,我必须使用图形API来实现吗?如果是,如何使用?如果没有,请给我提供解决方案。
发布于 2013-03-17 03:58:04
下面是我是如何做到的。
private void publishFeedDialog() {
System.out.println("Working");
Bundle postParams = new Bundle();
postParams.putString("name", "I am an Engineer");
postParams.putString("caption",
"Working very heard to make things work.");
postParams
.putString("description",
"This project is killing me, Still I am trying, and finally I got success.");
postParams.putString("link", "http://www.kodebusters.com");
postParams
.putString(
"picture",
"http://cdn1.iconfinder.com/data/icons/iconslandsport/PNG/128x128/Soccer_Ball.png");
new MYasync(postParams).execute();
}在AsyncTask上运行网络调用,否则可能会出现异常
class MYasync extends AsyncTask<Void, Void, Void> {
Bundle params;
private String res;
public MYasync(Bundle params) {
super();
this.params = params;
}
@Override
protected void onPostExecute(Void result) {
System.out.println(res);
super.onPostExecute(result);
}
@Override
protected Void doInBackground(Void... pp) {
try {
res = facebook.request("me/feed", params, "POST");
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MalformedURLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return null;
}
}https://stackoverflow.com/questions/15407338
复制相似问题