Hi, I’m getting data from database, first i retrieved a collection of 10 objects than i check if the list hot at the bottom getNextPage and add it to list array adapter, but if i have 24 total objects in database than after successfully retrieving 24 objects, when the list again hit the bottom, it adds the previous page data. it should return null but it keep returning the last page data. kindly help
here is the code of retrieving data objects when list hit the bottom
foundmessages is object of <BackendlessCollection<Messages>, that get first page
if (isAtBottom()) {
foundmessages.nextPage(new AsyncCallback<BackendlessCollection<Messages>>() {
@Override
public void handleResponse(BackendlessCollection<Messages> response) {
List<Messages> newList = response.getCurrentPage();
int size = response.getCurrentPage().size();
if (size< 0) {
Toast.makeText(getContext(), “No More Messages”, Toast.LENGTH_SHORT).show();
return;
}
else{
for (Messages message : newList) {
adapter.add(message);
}//forLoop
adapter.notifyDataSetChanged();
}//notNull-IfStatement
}//handleResponse
@Override
public void handleFault(BackendlessFault fault) {
Toast.makeText(getContext(), “Sorry, error in retrieving new messages\n” + fault.getMessage(), Toast.LENGTH_LONG).show();
}
});