0

I can successfully post an image to FB using the following code

byte[] data = null;      
ByteArrayOutputStream baos = new ByteArrayOutputStream();
photo.compress(Bitmap.CompressFormat.JPEG, 100, baos);
data = baos.toByteArray();

Bundle parameters = new Bundle();
parameters.putString("caption", "Test Caption");   
parameters.putString("method", "photos.upload");         
parameters.putByteArray("picture", data);  

AsyncFacebookRunner mAsyncRunner = new AsyncFacebookRunner(facebookClient);
mAsyncRunner.request(null, parameters, "POST", new SampleUploadListener(), null);

But when I try to have a URL in the caption as following

 parameters.putString("caption", "Test Caption: http://google.com/");

post is not get posted in FB wall

This is also not working

parameters.putString("caption", "Test Caption: /");

I think the wrong is in sending the / character when posting to the wall. I want to know is there a way to have url ( or / character) in the caption to post it in FB wall

Thank you for your help

Chatura Dilan
  • 1,502
  • 1
  • 16
  • 29

1 Answers1

1

Try escaping the / character by putting a forward slash so your string:

"Test Caption: http://google.com"

should be

"Test Caption: http:\/\/google.com"

Also,

mAsyncRunner.request(null, parameters,...

null should be me/photos.

Jesse Chen
  • 4,928
  • 1
  • 20
  • 20