Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2016
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. private static void basicPagingAsync() throws InterruptedException
  2. {
  3. long startTime = System.currentTimeMillis();
  4.  
  5. final AsyncCallback<BackendlessCollection<Restaurant>> callback=new AsyncCallback<BackendlessCollection<Restaurant>>()
  6. {
  7. private boolean firstResponse=true;
  8.  
  9. public void handleResponse( BackendlessCollection<Restaurant> restaurants )
  10. {
  11. if( firstResponse )
  12. {
  13. System.out.println( "Total restaurants - " + restaurants.getTotalObjects() );
  14. firstResponse=false;
  15. }
  16.  
  17. int size = restaurants.getCurrentPage().size();
  18. System.out.println( "Loaded " + size + " restaurants in the current page" );
  19.  
  20. if( size > 0 )
  21. restaurants.nextPage( this );
  22.  
  23. }
  24.  
  25. @Override
  26. public void handleFault( BackendlessFault backendlessFault )
  27. {
  28.  
  29. }
  30. };
  31.  
  32. Backendless.Data.of( Restaurant.class ).find( callback );
  33. System.out.println( "Total time (ms) - " + (System.currentTimeMillis() - startTime ));
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement