Backendless Support

How to retrieve data from all pages?

I want to get some data from all users in Users table. I've found that I have to use Data paging. I've written the same code as described in Feature 47-> (because I also have to sort) , but then I've figured out that this code takes data only from first page. Then , I decided that I have to go to the next page and read it , until its size is not equal to zero. Below,you can see my wrong solution:

QueryOptions queryOptions = new QueryOptions();

List<String> list = new ArrayList<String>() ;

list.add("point DESC") ;


BackendlessDataQuery backendlessDataQuery = new BackendlessDataQuery();


Backendless.Data.of(BackendlessUser.class).find(backendlessDataQuery, new AsyncCallback<BackendlessCollection<BackendlessUser>>() {


public void handleResponse(BackendlessCollection<BackendlessUser> one) {

while(one.getCurrentPage().size()>0) {

Iterator<BackendlessUser> it = one.getCurrentPage().iterator();

while (it.hasNext()) {

//something here,not so important


one.nextPage(this);// here I want to get next page,

//but seems like it does not work, cause my loop became infinite


}I think that I have to use nextPage method with AsyncCallback instead of one.nextPage(this) , but if I do so , the method couldn't keep up with the loop. So, how can I solve my problem?

Leave a Comment

Comments (1)



Please see the following article describing how paging works: