rahul
rahul

Reputation: 2661

how to post image on facebook in android?

I have in integer array in which I have images from drawable folder. Now I want to share image from that integer array to facebook wall.I tried the code below

    Uri imageuri  = Uri.parse("android.resource://" + "package name/" + mBitmapIds[int_image_position]);
    String filePath = imageuri.getEncodedPath();
    Bundle bundle=new Bundle();
    bundle.putString("picture", filePath);
    facebookConnector.getFacebook().request("me/feed", bundle, "POST");

where mBitmapIds is int array but it is not posting the image on wall. can anybody tell me how can I do that. Thanks in advance.

Upvotes: 3

Views: 2226

Answers (1)

Gunaseelan
Gunaseelan

Reputation: 15525

Try to use AsyncFacebookRunner.

Bundle bundle = new Bundle();
bundle.putString("message", "picture caption");
bundle.putByteArray("picture", ImageBytes);
mAsyncRunner.request("me/photos", param, "POST", new SampleUploadListener());

Kindly refer Android post picture to Facebook wall too.

I hope this will help you.

Upvotes: 2

Related Questions