【发布时间】:2021-04-18 22:56:21
【问题描述】:
我是安卓编程新手。我正在尝试创建商店详细信息活动。我目前正在使用用户日志记录显示 Cloud Firestore 数据/添加到 Fire Store 数据功能中。作为下一部分,我希望能够从应用程序更新云火石中的数据。现在我正试图将单个数据提取到单个活动中。我遇到了这个错误,我不知道如何解决它。 谢谢 我的列表活动类setUpRecyclerView函数;
Query query = todoRef.whereEqualTo("email", mAuth.getCurrentUser().getEmail());
FirestoreRecyclerOptions<ToDoItem> options = new FirestoreRecyclerOptions.Builder<ToDoItem>().setQuery(query,ToDoItem.class).build();
adapter = new ToDoAdapter(options);
我在这个函数中得到这个错误:
adapter = new ToDoAdapter(options);
^
required: FirestoreRecyclerOptions<ToDoItem>,Context,List<ToDoItem>
found: FirestoreRecyclerOptions<ToDoItem>
reason: actual and formal argument lists differ in length
将此代码添加到我的适配器类 ProductsAdaptor 函数时出现此错误
public ToDoAdapter(@NonNull FirestoreRecyclerOptions<ToDoItem> options
,Context mCtx, List<ToDoItem> productList) {
super(options);
this.mCtx = mCtx;
this.productList = productList;
}
当我从这个函数应用程序中取出List<Product> productList 代码时工作正常。
我该如何解决这个问题?
【问题讨论】:
-
您是否尝试过将构造函数与错误要求您提供的参数一起使用?如果您收到此错误,
ToDoAdapter一定不能有一个带有一个FirestoreRecyclerOptions<ToDoItem>参数的构造函数。 -
不,我没有说过我是 andorid 编程的新手。你能把代码贴在这里吗?
-
另外我更新了我的代码我发布了错误的函数
-
Firebase 实时数据库和 Cloud Firestore 是两个独立的数据库。请仅使用相关标签标记您的问题,不要同时使用两者。
-
请向我们展示您的
ToDoAdapter的内容。也请回复@AlexMamo
标签: java android firebase google-cloud-firestore firebaseui