When I do a request for a profile picture, mine in this case I receive some kind of encoded string in my HttpResponseHandler. The code below is the request for my profile picture.
private static AsyncHttpClient client = new AsyncHttpClient();
client.get("http://graph.facebook.com/1206433/picture", fbPictureHandler);
The code below is my handler to retrieve a response. I get the response as a string, but I am not sure what to do with this response object. I have tried converting to a byte array and writing to "file.jpg" this hasnt worked. My main question is what do I do with this response object?
private static AsyncHttpResponseHandler fbPictureHandler = new AsyncHttpResponseHandler ()
{
@Override
public void onStart() {
Log.d(TAG,"started picture handler");
}
@Override
public void onSuccess(String response) {
//Not sure what to do here, have been unable to do anything with this Byte //array
byte[] imageBackground = response.getBytes();
}
@Override
public void onFailure(Throwable error) {
Log.d(TAG, "unable to retrieve picture");
error.printStackTrace();
}
@Override
public void onFinish() {
Log.d(TAG,"Finished picture handler");
}
};
This is the PrintString of the response object
11-29 19:42:12.640: D/Yatter Facebook(3551): ÿØÿà��JFIF������������ÿþ��;CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), quality = 95
ANy help is greatly appreciated and hopefully this can help others.
Thank you,