android_catalogue1-10 Exercise 1: Export, Clear, Import ======================================================== Expected: 1. Export: "Backup saved." The file catalogue-backup.json exists where you chose. Opened in a text editor it is indented JSON: {"version": 1, "exportedAt": ..., "items": [ {"title": "...", "type": "Book", "tags": ["sci-fi"], ...}, ... ]}. Note: types and tags are names, and there are no ids. 2. Clear the app's storage, reopen (the catalogue is empty; the four types are re-seeded), then import: "Imported 6 items; 0 already present." Items, notes, tags and creation dates are back; the list order (newest first) is the same, because createdAt was exported and restored. 3. Import the SAME file again: "Imported 0 items; 6 already present." Each item matches an existing one on title, creator, type and creation time, so it is skipped. The catalogue does not double. 4. Edit a title by hand in the file, then import: the edited item no longer matches the stored one (its title differs), so it is ADDED as a new item: "Imported 1 item; 5 already present." You now have both the old and the edited versions. This shows that import merges and never updates or deletes. If you want "restore replaces", that is a different feature (clear the catalogue first, or match on a stable id stored in the file). Common problems: - The file picker greys out the file: its type is not in the accepted list; add its MIME type. - "That file is not a catalogue backup.": the JSON is malformed, or it is a different JSON file. - "Unknown item type": the file names a type other than Book, CD, DVD or Blu-ray; nothing was imported (the transaction rolled back).