No matter how hard I rack my brain, I can't seem to figure this out. Probably because I am a beginner at handling databases.
Below is the database schema for my android app:
Now when my app starts up, the initializations for all my tabs and my activity are called immediately, before the user even selects an option to start a new checklist or resume a current checklist. Since this is the way my app is programmed, I'm thinking I need to take an approach of something like this when my app starts up:
- Check if the checklist table is empty (first ever app launch)
- If it is empty, insert data for a new checklist, dont have to restore anything
- If it is not empty, find the latest checklist_id
- From the checklist_id, somehow find what checklist_items/vitals/notes correspond to each tab for that checklist_id
- Somehow retrieve the set of checklist_items/vitals/notes for each tab
- Restore the states based off the information I retrieved
Now, I may be thinking of this completely wrong. Also, I am very confused on what queries I would need to retrieve the information about each item (checklist_item, vital, note) corresponding to each tab (5 tabs in my app) for the latest checklist_id.
Aucun commentaire:
Enregistrer un commentaire