预期有 3 个参数但找到了 1 个
Expected 3 arguments but found 1
我是 android 编程新手。我正在尝试创建商店详细信息 activity。我目前正在使用用户登录显示 Cloud Firestore data/add 到 fire store 数据功能。作为下一部分,我希望能够从应用程序更新云火石中的数据。现在我正在尝试将单个数据拉入单个 activity。我遇到了这个错误,我不知道如何解决。
谢谢
我的列表活动 class 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
当我将此代码添加到我的适配器时出现此错误 class ProductsAdaptor 函数
public ToDoAdapter(@NonNull FirestoreRecyclerOptions<ToDoItem> options
,Context mCtx, List<ToDoItem> productList) {
super(options);
this.mCtx = mCtx;
this.productList = productList;
}
当我从这个函数中取出 List<Product> productList
代码时,应用程序工作正常。
我该如何解决这个问题?
要使构造函数正常工作,需要为其提供正确类型和数量的参数。这个构造函数有 3 个参数。你只提供了一个。创建它期望的另外两个(一个 Context
对象和一个 List<TodoItem>
对象)并将它们添加到您在构造 ToDoAdapter
时提供的参数中。更具体的代码在这里:
adapter = new ToDoAdapter(options, missingArgument1GoesHere, missingArgument2GoesHere);
我是 android 编程新手。我正在尝试创建商店详细信息 activity。我目前正在使用用户登录显示 Cloud Firestore data/add 到 fire store 数据功能。作为下一部分,我希望能够从应用程序更新云火石中的数据。现在我正在尝试将单个数据拉入单个 activity。我遇到了这个错误,我不知道如何解决。 谢谢 我的列表活动 class 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
当我将此代码添加到我的适配器时出现此错误 class ProductsAdaptor 函数
public ToDoAdapter(@NonNull FirestoreRecyclerOptions<ToDoItem> options
,Context mCtx, List<ToDoItem> productList) {
super(options);
this.mCtx = mCtx;
this.productList = productList;
}
当我从这个函数中取出 List<Product> productList
代码时,应用程序工作正常。
我该如何解决这个问题?
要使构造函数正常工作,需要为其提供正确类型和数量的参数。这个构造函数有 3 个参数。你只提供了一个。创建它期望的另外两个(一个 Context
对象和一个 List<TodoItem>
对象)并将它们添加到您在构造 ToDoAdapter
时提供的参数中。更具体的代码在这里:
adapter = new ToDoAdapter(options, missingArgument1GoesHere, missingArgument2GoesHere);