Created
September 26, 2017 07:41
-
-
Save mikkipastel/25112dd2f63f9cb571c4aa6a6895b96e to your computer and use it in GitHub Desktop.
paging library with Room in Android Architecture Component
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyViewModel extends ViewModel { | |
public final LiveData<PagedList<User>> usersList; | |
public MyViewModel(UserDao userDao) { | |
usersList = userDao.usersByLastName().create( | |
/* initial load position */ 0, | |
new PagedList.Config.Builder() | |
.setPageSize(50) | |
.setPrefetchDistance(50) | |
.build()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment