私が行ったいくつかの検索によると、SDカードに保存したばかりの画像を送信するために私が書いたものは次のとおりです
public void postToWall() throws FileNotFoundException, MalformedURLException, IOException {
loginToFacebook();
if (facebook.isSessionValid()) {
// Ok le login est bien enregistre
Bundle bundle = new Bundle();
bundle.putString("message","test");
File file = (File) this.getIntent().getExtras().get("PICTURE_TAKEN");
FileInputStream fis = new FileInputStream(file);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int data2 = 0;
while ((data2 = fis.read()) != -1)
baos.write(data2);
fis.close();
byte[] bytes = baos.toByteArray();
baos.close();
bundle.putByteArray("Picture", bytes);
mAsyncRunner.request("me/feed", bundle, "POST", new FacebookPostListener(), null);
}
}
テキストメッセージ「メッセージ」の投稿に成功しましたが、画像は投稿できませんでした。(追加の「PICTURE_TAKEN」は、撮影した写真に関連するファイルです)