在 FireStore Ui Recycler Paging Adapter 中使用 Paging 3 时出错:PagingConfig 无法转换为 Config
Error While using Paging 3 in FireStore Ui Recycler Paging Adapter: PagingConfig cannot be converted to Config
/*--- Load News Feed in Recycler View ---*/
private void loadNewsFeed(){
CollectionReference collectionReference = firebaseFirestore.collection("News Feed");
query = collectionReference
.orderBy("newsFeedId", Query.Direction.DESCENDING);
PagingConfig config = new PagingConfig(1,
1,
false);
FirestorePagingOptions<ModelNewsFeed> options = new FirestorePagingOptions.Builder<ModelNewsFeed>()
.setLifecycleOwner(this)
.setQuery(query, config, ModelNewsFeed.class)
.build();
adapterNewsFeedListFireStorePaginationAds = new AdapterNewsFeedListFireStorePaginationAds(options, this);
newsFeedRv.setAdapter(adapterNewsFeedListFireStorePaginationAds);
}
我在“.setQuery(query, config, ModelNewsFeed.class)”处遇到错误
Error: .setQuery(query, config, ModelNewsFeed.class)
^
method Builder.setQuery(Query,Config,Class<ModelNewsFeed>) is not applicable
(argument mismatch; PagingConfig cannot be converted to Config)
method Builder.setQuery(Query,Config,SnapshotParser<ModelNewsFeed>) is not applicable
(argument mismatch; PagingConfig cannot be converted to Config)
纠正此错误的解决方案是什么?
我正在尝试从
迁移
分页 2:
androidx.paging:分页运行时:2.1.2
到
分页 3:
androidx.paging:分页运行时:3.0.1.
Error Screen Shot
@dlam 在该线程的评论部分为我提供了解决方案。我的 android 工作室使用的是 Firebase ui 版本 7.1.1,它必须是 @dlam 提到的 8.0.0。并解决了问题。
/*--- Load News Feed in Recycler View ---*/
private void loadNewsFeed(){
CollectionReference collectionReference = firebaseFirestore.collection("News Feed");
query = collectionReference
.orderBy("newsFeedId", Query.Direction.DESCENDING);
PagingConfig config = new PagingConfig(1,
1,
false);
FirestorePagingOptions<ModelNewsFeed> options = new FirestorePagingOptions.Builder<ModelNewsFeed>()
.setLifecycleOwner(this)
.setQuery(query, config, ModelNewsFeed.class)
.build();
adapterNewsFeedListFireStorePaginationAds = new AdapterNewsFeedListFireStorePaginationAds(options, this);
newsFeedRv.setAdapter(adapterNewsFeedListFireStorePaginationAds);
}
我在“.setQuery(query, config, ModelNewsFeed.class)”处遇到错误
Error: .setQuery(query, config, ModelNewsFeed.class)
^
method Builder.setQuery(Query,Config,Class<ModelNewsFeed>) is not applicable
(argument mismatch; PagingConfig cannot be converted to Config)
method Builder.setQuery(Query,Config,SnapshotParser<ModelNewsFeed>) is not applicable
(argument mismatch; PagingConfig cannot be converted to Config)
纠正此错误的解决方案是什么?
我正在尝试从
迁移分页 2: androidx.paging:分页运行时:2.1.2
到
分页 3:
androidx.paging:分页运行时:3.0.1.
Error Screen Shot
@dlam 在该线程的评论部分为我提供了解决方案。我的 android 工作室使用的是 Firebase ui 版本 7.1.1,它必须是 @dlam 提到的 8.0.0。并解决了问题。