如何纠正错误 “实际和正式论点清单的长度不同”
正确构造了构造函数类,但仍显示此错误,该错误显示在“ notebookref.add ....”
private void saveNote() {
String title = editTextTitle.getText().toString();
String description = editTextDescription.getText().toString();
int priority = numberPickerPriority.getValue();
if (title.trim().isEmpty() || description.trim().isEmpty()) {
Toast.makeText(this, "Please insert a title and description", Toast.LENGTH_SHORT).show();
return;
}
CollectionReference notebookRef = FirebaseFirestore.getInstance()
.collection("Notebook");
notebookRef.add(new ContactsContract.CommonDataKinds.Note(title, description, priority));
Toast.makeText(this, "Note added", Toast.LENGTH_SHORT).show();
finish();
}
this is the error message being shown
"actual and formal argument lists differ in length"
参数
public class Note {
private String title;
private String description;
private int priority;
public Note() {
//empty constructor needed
}
public Note(String title, String description, int priority) {
this.title = title;
this.description = description;
this.priority = priority;
}
public String getTitle() {
return title;
}
public String getDescription() {
return description;
}
public int getPriority() {
return priority;
}
}