android-paging

Firestore pagination last visible document throws out of bound exception

一个人想着一个人 提交于 2020-07-09 12:09:05
问题 Have tried to use Firestore pagination by using these links https://stackoverflow.com/a/50742175/4232013 but i facing a ArrayIndexOutOfBoundsException suddenly after some added documents in collection can any one help me to point out where i am making a mistake thanks. My code: private int limit = 2; private int PostLimit = 1; private void GettingFollowingList() { followingList = new ArrayList<>(); String UserID = FirebaseAuth.getInstance().getUid(); followingList.add(UserID);

Firestore pagination last visible document throws out of bound exception

纵然是瞬间 提交于 2020-07-09 12:07:13
问题 Have tried to use Firestore pagination by using these links https://stackoverflow.com/a/50742175/4232013 but i facing a ArrayIndexOutOfBoundsException suddenly after some added documents in collection can any one help me to point out where i am making a mistake thanks. My code: private int limit = 2; private int PostLimit = 1; private void GettingFollowingList() { followingList = new ArrayList<>(); String UserID = FirebaseAuth.getInstance().getUid(); followingList.add(UserID);

Paging library - Boundary callback for network + db with API taking page and size

感情迁移 提交于 2020-07-04 07:23:01
问题 Short question : What is the correct way to handle database + network on the Paging library from Architecture components, using an API that uses page + size to load a new page and the BoundaryCallback class? Research and explanation Currently the class BoundaryCallback used in the paging library for architecture components, receives as parameter the instance of an element in the list without actual context of where this element is at. It happens in onItemAtFrontLoaded and onItemAtEndLoaded .

Paging library - Boundary callback for network + db with API taking page and size

心不动则不痛 提交于 2020-07-04 07:21:33
问题 Short question : What is the correct way to handle database + network on the Paging library from Architecture components, using an API that uses page + size to load a new page and the BoundaryCallback class? Research and explanation Currently the class BoundaryCallback used in the paging library for architecture components, receives as parameter the instance of an element in the list without actual context of where this element is at. It happens in onItemAtFrontLoaded and onItemAtEndLoaded .

Is it a good practice to observeForever in Repository class? db+network paged list

泪湿孤枕 提交于 2020-06-26 03:23:31
问题 Im building an app following architecture guidelines.Implemented room db caching + network.Need to get latest page number from separate entity. My model: @Entity(tableName = "top_rated_movie_page") public class Top_Rated_Movies_Page { @PrimaryKey(autoGenerate = true) private int db_id; private Integer page; private Integer total_results; private Integer total_pages; @Ignore private List<Result> results; ... Result class contains data which i display in my paged list which observes changes

LiveData Paged List size is always 0

偶尔善良 提交于 2020-05-27 06:16:05
问题 I implemented Paging using android paging library. The ViewModel returns a LiveData<PagedList<MyObject>> and I observe that in the fragment where I set the adapter and everything is working good, except that when I want to check the size of the list is always 0. viewModel.getSearchResults().observe(this, mList -> { adapter.submitList(mList); Log.e("Count", String.valueOf(mList.size())); }); Where mList is a PagedList<MyObject> 回答1: If you look at Loading Data from PagedList documentation you

LiveData Paged List size is always 0

…衆ロ難τιáo~ 提交于 2020-05-27 06:15:59
问题 I implemented Paging using android paging library. The ViewModel returns a LiveData<PagedList<MyObject>> and I observe that in the fragment where I set the adapter and everything is working good, except that when I want to check the size of the list is always 0. viewModel.getSearchResults().observe(this, mList -> { adapter.submitList(mList); Log.e("Count", String.valueOf(mList.size())); }); Where mList is a PagedList<MyObject> 回答1: If you look at Loading Data from PagedList documentation you