According to several searches I've made, here is what I have written in order to send an image I've just save on my SD card
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);
}
}
I succeed in posting the text message "message" but not the image ! (the extra "PICTURE_TAKEN" being the File related to the picture taken)
Ok so I've solved my problem just replace "me/feed" by "photos" in mAsyncRunner.request("me/feed", bundle, "POST", new FacebookPostListener(), null);