I have 7 class: MainActivity class (the place where Recycler View are shown), AddNote class, UpdateNote class, NoteDao class, NoteDatabase class (i use the singleton database structure), NoteAdapter class and Note class (model)
- **Below is the output of my current codes: **
1st: Initially, there is no Note item in the Recycler View, so i click the “ADD” button to add some notes, Eg: 1 and 2.
2nd: When i click “recycle bin” button, it will make the delete button appear for each item, so i can delete the item.
(https://i.sstatic.net/8MglsHyT.png)
3rd: So i click delete, and it seems CORRECT for the Recycler View:
(https://i.sstatic.net/bmp1eysU.png)
4th: So when i want to add new note,Eg: 3, 4, and 5, It also seems CORRECT.
(https://i.sstatic.net/UmAjOJLE.png)
(https://i.sstatic.net/YFTRWAdx.png)
5TH: THE PROBLEM LIES AT HERE: When i want to view each note, it appear the detail of the note before!
Eg: when i click on the 3, it give me 1
click 4, give me 2
click 5, give me 3… etc
I look up on this for whole 2 days using CHATGPT, CLAUDEAI, YOUTUBE, STACKOVERFLOW, GOOGLE still, didn’t now HOW TO SOLVE this problem… 🙁 Im feeling soooo tired.
IMO: i feel like this is due to i have wrongly written the code of deleting the item from the database. PROBLEM is now the ITEM is successfully deleted from the RecyclerView but failed to delete from the Room Database…
It should delete the Item from the RecyclerView and Room Database successfully.
Shen is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.