Skip to content

About

Native Android calorie tracking app with meal logging, nutrition API lookup, Room Database storage, camera image capture, and daily calorie goal tracking.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Repository files navigation

Calorie Tracker Android App

A native Android health and nutrition tracking app built with Java and Android Studio. The app allows users to set a daily calorie goal, log meals, capture meal images, fetch nutrition information from an external API, and store meal records locally using Room Database.

Overview

This project demonstrates Android application development using Java, XML layouts, fragments, Retrofit API integration, Room Database, local storage, camera integration, and user input handling. It was originally developed as an academic mobile application development project and later cleaned, documented, and prepared for portfolio presentation.

Reviewer Quick Scan

  • What it demonstrates: native Android development, nutrition API integration, Room persistence, camera capture, local settings, and responsive layouts.
  • Best files to inspect first: Screenshots/, app/build.gradle.kts, and app/src/main/java/com/example/healthcareapp/.
  • How to verify it: add an API key through local.properties, run the app in Android Studio, and review the included screenshots for implemented screens.

Features

  • Daily calorie goal calculation based on user details
  • Meal logging with food name, portion size, and meal type
  • Nutrition lookup using an external calorie API
  • Local meal storage using Room Database
  • Meal image capture using the device camera
  • Meal history view with saved entries
  • Meal detail view
  • Total calorie tracking
  • SharedPreferences for storing user goals and calorie totals
  • Portrait and landscape layout support

Project Preview

Main screen Meal logging Meal detail/history
Calorie tracker screen Meal logging screen Meal detail screen

Proof and Review Evidence

Evidence Where to inspect it What it proves
App screenshots Screenshots/ The repository includes visible proof of the Android UI.
API key template local.properties.example API configuration is documented without committing secrets.
Android manifest app/src/main/AndroidManifest.xml Permissions, app entry points, and Android configuration are visible.
Main layouts app/src/main/res/layout/ and app/src/main/res/layout-land/ Portrait and landscape UI resources are included.
Gradle app config app/build.gradle.kts Dependencies such as Room, Retrofit, OkHttp, Gson, and Glide are reviewable.
Source package app/src/main/java/com/example/healthcareapp/ Meal logging, nutrition lookup, persistence, and camera logic are inspectable.

Tech Stack

Category Technology
Language Java
Platform Android
UI XML Layouts
Architecture Fragment-based Android app
Database Room Database
API Client Retrofit, OkHttp
JSON Parsing Gson
Image Handling Camera intent, Glide
Local Storage SharedPreferences
Build Tool Gradle
IDE Android Studio

Project Structure

calorie-tracker-android/
|-- app/
|   |-- src/main/
|   |   |-- java/com/example/healthcareapp/   # Java app source
|   |   |-- res/                              # Layouts, values, drawables, XML resources
|   |   `-- AndroidManifest.xml               # Android app manifest
|   |-- build.gradle.kts                      # App-level Gradle config
|   `-- proguard-rules.pro
|-- Screenshots/                              # Captured app screens for review
|-- gradle/                                   # Gradle wrapper and version catalog
|-- local.properties.example                  # API-key template, safe to commit
|-- build.gradle.kts                          # Project-level Gradle config
|-- settings.gradle.kts
|-- gradlew / gradlew.bat
`-- README.md

API Key Setup

This app uses a calorie/nutrition API. For security, the API key is not stored directly in the repository.

  1. Copy the example file:
cp local.properties.example local.properties
  1. Add your own API key:
CALORIE_NINJAS_API_KEY=your_api_key_here
  1. Open the project in Android Studio and run the app.

Note: local.properties is ignored by Git and should not be committed.

Getting Started

Prerequisites

Before running the project, make sure you have:

  • Android Studio installed
  • Android SDK installed
  • JDK 17 or Android Studio bundled JDK
  • Android emulator or physical Android device
  • A valid calorie API key for nutrition lookup

How to Run

Option 1: Run with Android Studio

  1. Clone the repository:
git clone https://github.com/Chanindhu/Calorie-tracker-android.git
  1. Open the project in Android Studio.

  2. Create a local.properties file using local.properties.example.

  3. Add your API key.

  4. Wait for Gradle sync to complete.

  5. Select an emulator or connect a physical Android device.

  6. Click Run.

Option 2: Build from Terminal

For Windows:

.\gradlew.bat assembleDebug

For macOS/Linux:

chmod +x ./gradlew
./gradlew assembleDebug

The debug APK will be generated in:

app/build/outputs/apk/debug/

To install the app on a connected device:

For Windows:

.\gradlew.bat installDebug

For macOS/Linux:

./gradlew installDebug

What I Learned

Through this project, I practised:

  • Building native Android applications using Java
  • Creating fragment-based navigation
  • Designing Android screens with XML layouts
  • Integrating external APIs with Retrofit
  • Managing local data with Room Database
  • Handling camera image capture
  • Using SharedPreferences for small local settings
  • Managing Android permissions
  • Preparing a mobile app project for GitHub portfolio presentation

Future Improvements

  • Improve UI design and visual consistency
  • Add stronger validation for user input
  • Improve API error handling
  • Add loading indicators during nutrition lookup
  • Add charts for calorie progress
  • Add edit and delete functionality for meal logs
  • Improve image storage and compression
  • Add unit tests for calorie calculation and database logic
  • Rename package from com.example.healthcareapp to a production-style package name

Project Background

This project was originally developed as part of a mobile application development assignment. It has been cleaned, renamed, documented, and prepared as a portfolio project to demonstrate Android development, API integration, local persistence, and mobile UI implementation skills.

License

This project is available for educational and portfolio purposes.

About

Native Android calorie tracking app with meal logging, nutrition API lookup, Room Database storage, camera image capture, and daily calorie goal tracking.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages