0

When i write a code according to other page it gives an error "unresolved reference in RoomSQL"

here are my codes:

@Entity(tableName = "notes")
public class Notes implements Serializable {

    @PrimaryKey(autoGenerate = true)
    int ID = 0;

    @ColumnInfo(name = "title")
    String title = "";

    @ColumnInfo(name = "notes")
    String notes = "";

    @ColumnInfo(name = "date")
    String date = "";

    @ColumnInfo(name = "pinned")
    boolean pinned = false;

    public int getID() {
        return ID;
    }

    public void setID(int ID) {
        this.ID = ID;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getNotes() {
        return notes;
    }

    public void setNotes(String notes) {
        this.notes = notes;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public boolean isPinned() {
        return pinned;
    }

    public void setPinned(boolean pinned) {
        this.pinned = pinned;
    }

so when i try to write "notes" in other tab it says "unresolved"

here are my codes:

public interface MainDAO {
   @Insert(onConflict = REPLACE)
    void insert(Notes notes);

   @Query("SELECT * FROM notes ORDER BY id DESC")
   List<Notes> getAll();

   @Query("UPDATE notes SET title = :title, notes = :notes WHERE ID = :id")
   void update(int id, String title, String notes);

   @Delete
   void delete(Notes notes);
}

error is on 6. and 9. line

BadIdeaException
  • 2,125
  • 15
  • 32
  • Are those classes in the same package? Did you add an import statement for your Notes class? – OH GOD SPIDERS Aug 29 '23 at 11:59
  • they are not in same package, i watch a video but he has no problem about it, i do it whatever he do. The link of video: https://youtu.be/Shh0N45S4hE?si=ZpV8CSUDQYn1gk5L you should watch video until 16. min – Nisanur Turan Aug 29 '23 at 13:57

0 Answers0