Skip to content Skip to sidebar Skip to footer

Android Facebook Album Photos Request Only Returns 25 Photos

So i am trying to display facebook photos from an album in and Android app. The problem i am having is if i call this: facebookAsyncRunner.request(albumId + '/photos', new UserAlbu

Solution 1:

I have posted an answer which integrates pagination for an Endless Scrolling List here:

https://stackoverflow.com/a/13265776/450534

It is too big to post all over again, so am linking to the original answer instead. The answer is literally a complete a solution on how to make a Facebook query to an Album, fetch all photos (limited initially with a limit=10) and then fetching additional photos from the album when the user has scrolled down to the end and adding them to the existing list of Photos already fetched.

It uses a GridView instead of a ListView but the logic remain the exact same.

Alternatively, if you are looking only for a way to fetch Photos, here is a far simpler solution to get you started.

try {
    String test = Utility.mFacebook.request("/10151498156121729/photos&access_token=YOUR_ACCESS_TOKEN?limit=1");
    Log.e("TEST", test);
} catch (Exception e) {
    // TODO: handle exception
}

The Album ID (10151498156121729) used in the code block above, is a Facebook Public Album.

I use the Utility class from the pre-3.0 Facebook SDK's HackBook example. If you are using the 3.0 SDK, I think you will need to substitute the Utility.mFacebook.request bit with an instance of the Facebook class

Solution 2:

You should need to use Pagination for getting more than 25 photos. You can get only 25 items as result for a single query. To load the next 25 you should use the code like below:

facebookAsyncRunner.request(albumId + "/photos?offset=25&limit=25", newUserAlbumPhotosFetchListener(JSONResponse, photoView));

this will return the next 25 items, in this case the photos from 25th position to 50th position.

Try in this way.. Hope this may solve your problem.

Post a Comment for "Android Facebook Album Photos Request Only Returns 25 Photos"