The Memory Gallery gives kids a personal scrapbook inside the app — a scrollable grid of photos and titles they have saved themselves. Every memory is stored locally in a SQLite database, so the collection persists between sessions and never requires an internet connection. Parents and children can add new photos by picking from the device gallery or snapping a fresh picture with the camera.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/SaadAhmed1122/Kids_learnig_App/llms.txt
Use this file to discover all available pages before exploring further.
Database Schema
All memories are persisted in a SQLite database managed byMemoryDbHelper, which extends SQLiteOpenHelper.
| Property | Value |
|---|---|
| Database name | memories.db |
| Database version | 1 |
| Table name | memories |
Table Columns
| Column | Type | Notes |
|---|---|---|
_id | INTEGER PRIMARY KEY | Auto-incremented row ID |
title | TEXT | User-supplied label for the memory |
image | TEXT | Base64-encoded bitmap string |
Images are resized to 250 × 250 pixels before being encoded and written to the database. The
Memory model handles this automatically via resizeBitmap(), so storage stays compact regardless of the original photo size.MemoryDbHelper Methods
addMemory() returns true when the row is inserted successfully (db.insert() returns a valid row ID). readAllMemories() returns a Cursor over every row in the table, which is handed directly to MemoriesAdapter.
How to Use the Gallery
Open the Gallery
From
FinalmainScreen, tap the Gallery button. This calls showgellery(), which launches Show_ImagesMain. The screen inflates activity_show__images_main and loads a GridView (R.id.activity_main_grid_view) backed by a MemoriesAdapter (a CursorAdapter).Browse Your Memories
The
GridView displays all saved memories returned by MemoryDbHelper.readAllMemories(). If the database is empty, an empty-state view (R.id.activity_main_empty_view) is shown automatically. A banner ad (AdView) is loaded at the bottom of the screen via MobileAds.Add a New Memory
Tap the + button (
addNewMemory(View)). This starts the AddImge activity, which inflates activity_add_imge and presents two image-source options alongside a title field.Choose an Image
- From Gallery — fires
ACTION_GET_CONTENTwith MIME typeimage/*(GALLERY_REQUEST_CODE = 100). The system image picker returns the selected image viaonActivityResult. - From Camera — fires
ACTION_IMAGE_CAPTURE(CAMERA_REQUEST_CODE = 200). The captured bitmap is returned in the activity result extras.
selectedImageView (R.id.new_memory_selected_image).Enter a Title
Type a name for the memory in
titleEditText (R.id.new_memory_title). This label appears beneath the thumbnail in the gallery grid.The Memory Model
Memory.java is the data class that sits between the UI and the database.
Memory(String, Bitmap)
Used when saving a new photo. The bitmap is first scaled to 250 × 250 via
resizeBitmap() (using Matrix.postScale), then converted to a Base64 string by bitmapToString(). Only the string is written to SQLite.Memory(Cursor)
Used when reading from the database. The constructor reads the
title column as a plain string and the image column as a Base64 string. Calling getImage() decodes the string back to a Bitmap on demand.Key Accessors
| Method | Return type | Description |
|---|---|---|
getTitle() | String | Returns the memory’s display title |
getImage() | Bitmap | Decodes the stored Base64 string into a Bitmap |
getImageAsString() | String | Returns the raw Base64 string for database storage |
Image Size Constants
Persistence and Lifecycle
The
memories.db database is stored in the app’s internal private storage. Data persists across app restarts, device reboots, and background kills — it is only removed when the app is uninstalled or the user clears app data.Show_ImagesMain swaps the adapter’s cursor inside onResume(). This means any memory added in AddImge is immediately visible when the player navigates back to the gallery, without needing to restart the screen or manually refresh.