Android : Fetch facebook albums and cover photos

on Sunday, October 26, 2014


Inside my app, I let users to upload photos from Facebook. So first I fetch all user albums with:



new Request(session, "/me/albums", null, HttpMethod.GET, new Request.Callback() {
public void onCompleted(Response response) {
}
};


and then I'm using an Adapter to show every album inside a GridView, so inside the getView method I call /{album-id}/picture, but I don't know how to parse the Response. What I have to do with the Response object to display the image inside an ImageView? Is there any better way to do this?


This is how I made the request



Bundle params = new Bundle();
params.putString("type", "thumbnail");
String albumid = albums.get(position);
new Request(session, "/"+ albumid +"/picture",
params, HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {

ViewHolder holder = new ViewHolder();
}
}
).executeAsync();


And this is what I get:



{Response: responseCode: 200, graphObject: GraphObject{graphObjectClass=GraphObject, state={"FACEBOOK_NON_JSON_RESULT":"����\u0000\u0010JFIF\u0000\u0001\u0002\u0000\u0000\u0001\u0000\u0001\u0000\u0000��\u0000\u0004*\u0000��\u0002\u001cICC_PROFILE\u0000\u0001\u0001\u0000\u0000\u0002"}}, error: null, isFromCache:false}



0 comments:

Post a Comment