Android的Facebook相册的照片要求只返回25张照片 [英] Android Facebook album photos request only returns 25 photos

查看:148
本文介绍了Android的Facebook相册的照片要求只返回25张照片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我试图从一个专辑和Android应用程序显示Facebook的照片。

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 UserAlbumPhotosFetchListener(JSONResponse, photoView));

我得到的25张照片数组的JSONResponse。不过,我需要的不仅仅是25张照片更多...我需要所有的人都在专辑。所以我尝试调用此:

i get a JSONResponse of an array of 25 photos. However, i need more than just 25 photos... i need all of them in the album. So i tried calling this:

facebookAsyncRunner.request(albumId + "/photos?limit=50", new UserAlbumPhotosFetchListener(JSONResponse, photoView));

在试图获得50张照片,而不是25。这没有奏效。相反,我什么也没得到。
我也试着打电话与极限= 0同样的事情,但是这是给我同样的结果。
要具体:JSONResponse.getJSONArray(数据)= []

in an attempt to get 50 photos instead of 25. This did not work. Instead i got nothing. I also tried calling this same thing with limit=0, but this is giving me the same result. to be specific: JSONResponse.getJSONArray("data") = []

有没有人有什么发生的任何想法/如何要求的不仅仅是25多张照片从影集?

Does anyone have any idea of what is happening/ how to request more than just 25 photos from an album?

谢谢!

编辑:我找到了解决办法。

I found a solution!

捆绑PARAMS =新包();
        params.putString(限制,10);
        facebookAsyncRunner.request(ALBUMID +/照片,则params,新UserAlbumPhotosFetchListener(JSONResponse,PhotoView中));

推荐答案

我已经发布这这里集成了无尽滚动列表分页答案:

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

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

有太大一遍后,让我连接到原来的答案,而不是。答案是字面上就如何使Facebook的查询到相册,获取所有的照片(带限位= 10最初只限于),然后取出由相册的更多照片当用户向下滚动至年底,并增加了完整的解决方案他们的照片的现有列表已经获取的。

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.

它采用了 GridView控件,而不是的ListView 但逻辑仍然是完全一样的。

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
}

在code以上的块所用的相册ID(10151498156121729),是一个Facebook的公开相册。

我用的是实用类从pre-3.0的Facebook SDK的HackBook例子。如果您使用的是3.0 SDK,我想你会需要使用Facebook类的一个实例。

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

这篇关于Android的Facebook相册的照片要求只返回25张照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆