this my Code
@Entity(tableName = "tasks")
public final class Task { private static final String TAG = "Task";
@PrimaryKey
@NonNull
@ColumnInfo(name = "entryId")
private final String mId;
@Nullable
@ColumnInfo(name = "title")
private final String mTitle;
@Nullable
@ColumnInfo(name = "description")
private final String mDescription;
@ColumnInfo(name = "completed")
private final boolean mCompleted;
public Task(@NonNull String Id, @Nullable String Title, @Nullable String Description, boolean Completed) {
mId = Id;
mTitle = Title;
mDescription = Description;
mCompleted = Completed;
}
/**
* 这个构造函数用来创建正在执行的任务
* 新建立的任务不可能马上被完成,
* 所以这里completed = false
*/
@Ignore
public Task(@Nullable String Title, @Nullable String Description) {
this(UUID.randomUUID().toString(), Title, Description, false);
}
/**
* 如果任务已经有了id,那么就创建一个正在执行的任务
* 新建立的任务不可能马上被完成,
* 所以这里completed = false
*/
@Ignore
public Task(@NonNull String Id, @Nullable String Title, @Nullable String Description) {
this(Id, Title, Description, false);
}
/**
* 使用这个构造函数创建一个已完成的任务
*/
@Ignore
public Task(@Nullable String Title, @Nullable String Description, boolean Completed) {
this(UUID.randomUUID().toString(), Title, Description, Completed);
}
@Nullable
public String getDescription() {
return mDescription;
}
@NonNull
public String getId() {
return mId;
}
@Nullable
public String getTitle() {
return mTitle;
}
but i got a error,PLEASE HELP ME , this is google MVP sample github:https://github.com/googlesamples/android-architecture/tree/todo-mvp/
AND THIS IS MY ERROR:
Error:(16, 14) error: Entities and Pojos must have a usable public constructor. You can have an empty constructor or a constructor whose parameters match the fields (by name and type). Tried the following constructors but they failed to match: Task(java.lang.String,java.lang.String,java.lang.String,boolean) : [Id : null, Title : null, Description : null, Completed : null]
I'M THE NEW ONE, PLEASE HELP ME,THANK U VERY MUCH !!!!