ExpenseTracker

πŸ’Έ ExpenseTracker

A fully-featured personal expense tracking app built as a native Android application using a WebView-based architecture. No sign-in required. All data stored locally on your device.


πŸ“± Screenshots

image image image image image image image


✨ Features

πŸ’° Transactions

πŸ“Š Analytics

πŸ’‘ Budgeting

🏷️ Categories

πŸ“€ Data Transfer

🎨 Quality of Life

🏠 Home Screen Widgets


πŸ› οΈ Tech Stack

Layer Technology
Android wrapper Kotlin + WebView
UI HTML, CSS, JavaScript (single file)
Storage localStorage (WebView) + SharedPreferences (widget)
Excel export SheetJS (xlsx.js)
Fonts Google Fonts (Syne + DM Mono)
Build Android Studio, Gradle 8.2
Min SDK Android 7.0 (API 24)
Target SDK Android 14 (API 34)

πŸš€ Getting Started

Prerequisites

Build & Run

  1. Clone the repository:
    git clone https://github.com/YOUR_USERNAME/ExpenseTracker.git
    
  2. Open the project in Android Studio:
    • File β†’ Open β†’ select the ExpenseTracker folder
  3. Wait for Gradle to sync (first time may take a few minutes)

  4. Build the APK:
    • Build β†’ Build Bundle(s) / APK(s) β†’ Build APK(s)
    • APK will be at app/build/outputs/apk/debug/app-debug.apk
  5. Install on your phone:
    • Transfer the APK to your phone
    • Enable Install unknown apps in your phone settings
    • Tap the APK to install

πŸ“‚ Project Structure

ExpenseTracker/
β”œβ”€β”€ app/src/main/
β”‚   β”œβ”€β”€ assets/
β”‚   β”‚   └── index.html          # Entire app UI (HTML/CSS/JS)
β”‚   β”œβ”€β”€ java/com/expensetracker/
β”‚   β”‚   β”œβ”€β”€ MainActivity.kt     # WebView host + JS bridge
β”‚   β”‚   β”œβ”€β”€ ExpenseWidget.kt    # Add Expense home screen widget
β”‚   β”‚   └── RecentExpensesWidget.kt  # Recent Expenses widget
β”‚   β”œβ”€β”€ res/
β”‚   β”‚   β”œβ”€β”€ layout/
β”‚   β”‚   β”‚   β”œβ”€β”€ activity_main.xml
β”‚   β”‚   β”‚   β”œβ”€β”€ widget_add_layout.xml
β”‚   β”‚   β”‚   └── widget_recent_layout.xml
β”‚   β”‚   β”œβ”€β”€ xml/
β”‚   β”‚   β”‚   β”œβ”€β”€ widget_add_info.xml
β”‚   β”‚   β”‚   β”œβ”€β”€ widget_recent_info.xml
β”‚   β”‚   β”‚   └── file_paths.xml
β”‚   β”‚   └── drawable/
β”‚   β”‚       └── widget_background.xml
β”‚   └── AndroidManifest.xml

πŸ”„ Switching Phones

All your data (transactions, photos, budgets, settings) can be transferred between phones:

  1. On your old phone: Settings β†’ Export Backup (JSON)
  2. Copy the .json file to your new phone (WhatsApp, Google Drive, USB, etc.)
  3. On your new phone: Settings β†’ Import Data β†’ select the file
  4. Everything is restored including receipt photos

πŸ” Privacy


πŸ“‹ Permissions

Permission Reason
INTERNET Load Google Fonts on first launch
READ_EXTERNAL_STORAGE Import backup files
WRITE_EXTERNAL_STORAGE Save exported files to Downloads (Android ≀ 9)
READ_MEDIA_IMAGES Pick receipt photos from gallery (Android 13+)

πŸ§‘β€πŸ’» Development Notes

JS ↔ Android Bridge

The app communicates between JavaScript and Kotlin via @JavascriptInterface:

// Called from JS to save a file
fun exportData(data: String, filename: String, encoding: String)

// Called from JS to refresh the Recent Expenses widget
fun updateWidget(recentJson: String)

// Called from JS to trigger the file picker
fun triggerImport()

Adding the Widgets

After installing the app:

  1. Long press your home screen
  2. Tap Widgets
  3. Find ExpenseTracker
  4. You’ll see two widgets β€” drag either one to your home screen

πŸ“„ License

This project is for personal use.


πŸ‘€ Author

Created by βˆ…M