Image on Facebook using the Facebook SDK

I follow Custom Story on Android . I want to use a common image only when you select an image from the gallery. But I get a Null Pointer Exception error . Are there any suggestions how I can solve this. Thank.

The code for my image. Here

My mistake. Error

+3
source share
1 answer

you need to convert it to an array of bytes, and then in your Bundle you need to pass this ByteArray, like this

Bundle postParams = new Bundle();
Bitmap bmp = "your bitmap";
ByteArrayOutputStream stream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.PNG, 100, stream);
byte[] byteArray = stream.toByteArray();
postParams.putByteArray("images", bytearray);

finally you need to install this

Request request = new Request(session, "me/photos", postParams,
                    HttpMethod.POST, callback);
+1
source

All Articles