@Override public List<String> loadInBackground(){
  ArrayList<String> entries=new ArrayList<>();
  if (mHasNext && !mIsLoading) {
    mIsLoading=true;
    try {
      Thread.sleep(2000);
    }
 catch (    InterruptedException e) {
      e.printStackTrace();
    }
    if (offset < perPage * 10) {
      for (int i=offset; i < offset + perPage; i++)       entries.add("A fancy list item #" + (i + 1));
    }
    if (entries.isEmpty()) {
      mHasNext=false;
    }
 else {
      mHasNext=entries.size() >= perPage;
      offset+=perPage;
    }
  }
  return entries;
}

@ Override public List < String > loadInBackground ( ) { ArrayList < String > entries = new ArrayList < > ( ) ; if ( mHasNext && ! mIsLoading ) { mIsLoading = true ; try { Thread . sleep ( 2000 ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } if ( offset < perPage * 10 ) { for ( int i = offset ; i < offset + perPage ; i ++ ) entries . add ( "A fancy list item #" + ( i + 1 ) ) ; } if ( entries . isEmpty ( ) ) { mHasNext = false ; } else { mHasNext = entries . size ( ) >= perPage ; offset += perPage ; } } return entries ; }
this is where the bulk of our work is done . this function is called in a background thread and should generate a new set of data to be published by the loader .
