Android/Facebook:在我的Facebook上发布SD卡上的图像';长城
根据我所做的几次搜索,以下是我为了发送我刚刚保存在SD卡上的图像而写的内容Android/Facebook:在我的Facebook上发布SD卡上的图像';长城,android,facebook,sd-card,Android,Facebook,Sd Card,根据我所做的几次搜索,以下是我为了发送我刚刚保存在SD卡上的图像而写的内容 public void postToWall() throws FileNotFoundException, MalformedURLException, IOException { loginToFacebook(); if (facebook.isSessionValid()) { // Ok le login est bien enregistre Bundl
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);
}
}
我成功地发布了短信“message”,但没有发布图片!
(额外的“PICTURE\u take”是与拍摄的照片相关的文件)如果您要开始一个新项目,您应该使用非常容易发布照片的位置:请参阅。好的,我已经解决了我的问题 只需将“我/订阅”替换为“照片” 在mAsyncRunner.request中(“me/feed”,bundle,“POST”,newFaceBookPostListener(),null) 我需要你的帮助: