发布多个图片 - Android - > Facebook的

时间:2014-01-03 18:16:31

标签: android facebook

我需要一个Java(Android)示例,使用AsyncFacebookRunner在一个帖子中发布两张照片和一个文本。

1 个答案:

答案 0 :(得分:1)

private void sendPhoto(String status) {


    for (int i = 0; i < caminhoImagens.size(); i++) {
        EnviaPhoto(status, caminhoImagens.get(i), i);
    }

}

}

private void EnviaPhoto(String status, String camImg, int i) {

    // TODO Auto-generated method stub
    Bitmap yourSelectedImage = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + camImg); 
    image = yourSelectedImage;
    AsyncFacebookRunner runner = new AsyncFacebookRunner(facebook);

    ByteArrayOutputStream baos = new ByteArrayOutputStream();

    image.compress(Bitmap.CompressFormat.PNG, 100, baos);

    byte[] bytes = baos.toByteArray();

    Bundle params = new Bundle();
    params.putByteArray("picture", bytes);
    params.putString("message", status);
    if (i != 0){
        corpo = "";
    }


    runner.request("me/photos", params, "POST", requestListener, null);
}