Android Facebook相册照片请求只返回25张照片 [英] Android Facebook album photos request only returns 25 photos
问题描述
我遇到的问题是如果我打电话给我:
facebookAsyncRunner.request(albumId +/ photos,新的UserAlbumPhotosFetchListener(JSONResponse,photoView));
我得到一组25张照片的JSONResponse。但是,我需要超过25张照片...我需要所有这些照片。所以我尝试调用这个:
facebookAsyncRunner.request(albumId +/ photos?limit = 50,新的UserAlbumPhotosFetchListener(JSONResponse, PhotoView中));
试图获得50张照片,而不是25张。这没有办法。相反,我什么也没有。
我也尝试使用limit = 0调用同样的东西,但这是给我相同的结果。
具体:JSONResponse.getJSONArray(data)= []
有没有人知道发生了什么/如何请求不只是
谢谢!
编辑:我找到了一个解决方案!
Bundle params = new Bundle();
params.putString(limit,10);
facebookAsyncRunner.request(albumId +/ photos,params,new UserAlbumPhotosFetchListener(JSONResponse,photoView));
我已经发布了一个答案,其中集成了无限滚动列表的分页:
https://stackoverflow.com/a/13265776/450534
太大了,不能再发贴,所以链接到原来的答案。答案是一个完整的解决方案,如何使Facebook查询到相册,获取所有照片(限制最初限制= 10),然后从相册中提取其他照片,当用户滚动到最后和添加他们已经获取了现有的照片列表。
它使用一个 GridView
而不是一个 ListView
,但逻辑仍然是完全相同的。
或者,如果您只查找 fetch照片,这是一个更简单的解决方案,让你开始。
try {
String test = Utility.mFacebook .request( / 10151498156121729 /相片和?=的access_token限制YOUR_ACCESS_TOKEN = 1);
Log.e(TEST,test);
} catch(Exception e){
// TODO:handle exception
}
在上面的代码块中使用的相册ID(10151498156121729)是Facebook公开相册。
我使用实用程序从3.0之前的SDK SDK的HackBook的例子。如果您使用的是3.0 SDK,我认为您将需要使用Facebook类实例
替换 Utility.mFacebook.request
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));
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));
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") = []
Does anyone have any idea of what is happening/ how to request more than just 25 photos from an album?
thanks!
EDIT: I found a solution!
Bundle params = new Bundle();
params.putString("limit", "10");
facebookAsyncRunner.request(albumId + "/photos", params, new UserAlbumPhotosFetchListener(JSONResponse, photoView));
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
这篇关于Android Facebook相册照片请求只返回25张照片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!