I have two fragment 1. Test Fragment 2. Test Detail Fragment
1. Test Fragment I would like to display
- Test 1 - 15/9/23 9:00(current date and time)
- Test 2 - 15/9/23 9:15(current date and time)
2. Test Detail Fragment I wiould like to display
- Clicking on item one from the List view it will look like this
- Test1 (name of list view item)
- 1. abc2 - 12s,
- 2. abc2 -10s,
- 3. abc3 - 30s
In my kotlin app with room database entity Test and TestDetails. How do i create dao and view model and get that value into fragment?
Tuhin PaulPosted Apr 25, 2023, 6:12 AM
Part 1:
To retrieve the data from the Room database and display it in the appropriate fragments, Define the entities for the "Test" and "Test Detail" tables in the Room database.
Tuhin PaulPosted Apr 25, 2023, 6:13 AM
Part 2:
Also Create a data access object (DAO) for each entity to define the methods for accessing the data.
And then Create a database class that extends the RoomDatabase class and defines the methods for accessing the DAOs.