Parse.com - 检索1000余行 [英] Parse.com - retrieve more than 1000 rows
问题描述
我用解析检索列表视图中的数据已经。不幸的是,他们限制请求默认为100至1000最大。我已经远远超过了1000 Max在我的课。我发现它显示了一个办法做到这一点在iOS Web上的链接,但你会怎么做这在Android? <一href="http://alexefish.com/post/29843064002/fetching-every-row-of-a-table-with-parse-and-pfquery">Web链接
I have been using Parse to retrieve a data for a list view. Unfortunately they limit requests to 100 by default to a 1000 max. I have well over that 1000 max in my class. I found a link on the web which shows a way to do it on iOS but how would you do it on Android? Web Link
我目前加入所有数据到一个数组列表中循环,直到所有项目完成(100),然后将其添加到列表
I am currently adding all the data into a arraylist in a loop until all items are complete (100) then adding them to the list
推荐答案
我已经找到了如何实现我的目标:
I have figured out how to achieve my goal:
声明全局变量
private static List<ParseObject>allObjects = new ArrayList<ParseObject>();
创建查询
final ParseQuery parseQuery = new ParseQuery("Objects");
parseQuery.setLimit(1000);
parseQuery.findInBackground(getAllObjects());
回调查询
int skip=0;
FindCallback getAllObjects(){
return new FindCallback(){
public void done(List<ParseObject> objects, ParseException e) {
if (e == null) {
allObjects.addAll(objects);
int limit =1000;
if (objects.size() == limit){
skip = skip + limit;
ParseQuery query = new ParseQuery("Objects");
query.setSkip(skip);
query.setLimit(limit);
query.findInBackground(getAllObjects());
}
//We have a full PokeDex
else {
//USE FULL DATA AS INTENDED
}
}
};
}
这篇关于Parse.com - 检索1000余行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!