Skip to main content

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.

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.

Database Schema

All memories are persisted in a SQLite database managed by MemoryDbHelper, which extends SQLiteOpenHelper.
PropertyValue
Database namememories.db
Database version1
Table namememories

Table Columns

ColumnTypeNotes
_idINTEGER PRIMARY KEYAuto-incremented row ID
titleTEXTUser-supplied label for the memory
imageTEXTBase64-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

// Add a new memory
public boolean addMemory(Memory memory) {
    SQLiteDatabase db = getWritableDatabase();
    ContentValues values = new ContentValues();
    values.put(MemoryContract.MemoryEntry.COLUMN_TITLE, memory.getTitle());
    values.put(MemoryContract.MemoryEntry.COLUMN_IMAGE, memory.getImageAsString());
    return db.insert(MemoryContract.MemoryEntry.TABLE_NAME, null, values) != -1;
}

// Read all memories
public Cursor readAllMemories() {
    SQLiteDatabase db = getReadableDatabase();
    return db.query(MemoryContract.MemoryEntry.TABLE_NAME, null, null, null, null, null, null);
}
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.
1

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).
2

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.
3

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.
4

Choose an Image

  • From Gallery — fires ACTION_GET_CONTENT with MIME type image/* (GALLERY_REQUEST_CODE = 100). The system image picker returns the selected image via onActivityResult.
  • From Camera — fires ACTION_IMAGE_CAPTURE (CAMERA_REQUEST_CODE = 200). The captured bitmap is returned in the activity result extras.
The chosen image is previewed immediately in selectedImageView (R.id.new_memory_selected_image).
5

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.
6

Save or Cancel

  • Save (save(View)) — constructs a Memory(title, bitmap) object, calls MemoryDbHelper.addMemory(), and calls finish() to return to the gallery.
  • Cancel (cancel(View)) — calls finish() without saving anything.

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

MethodReturn typeDescription
getTitle()StringReturns the memory’s display title
getImage()BitmapDecodes the stored Base64 string into a Bitmap
getImageAsString()StringReturns the raw Base64 string for database storage

Image Size Constants

public static final int PREFERRED_WIDTH  = 250;
public static final int PREFERRED_HEIGHT = 250;
All bitmaps are normalized to these dimensions before encoding, keeping the database size predictable.

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.
Because MemoriesAdapter extends CursorAdapter, view recycling is handled automatically. The GridView stays smooth even as the memory collection grows, since only the visible thumbnails are decoded into Bitmap objects at any given moment.

Build docs developers (and LLMs) love