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.
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.
- 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, andapp/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.
- 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
| Main screen | Meal logging | Meal detail/history |
|---|---|---|
| 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. |
| 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 |
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
This app uses a calorie/nutrition API. For security, the API key is not stored directly in the repository.
- Copy the example file:
cp local.properties.example local.properties- Add your own API key:
CALORIE_NINJAS_API_KEY=your_api_key_here
- Open the project in Android Studio and run the app.
Note:
local.propertiesis ignored by Git and should not be committed.
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
- Clone the repository:
git clone https://github.com/Chanindhu/Calorie-tracker-android.git-
Open the project in Android Studio.
-
Create a
local.propertiesfile usinglocal.properties.example. -
Add your API key.
-
Wait for Gradle sync to complete.
-
Select an emulator or connect a physical Android device.
-
Click Run.
For Windows:
.\gradlew.bat assembleDebugFor macOS/Linux:
chmod +x ./gradlew
./gradlew assembleDebugThe debug APK will be generated in:
app/build/outputs/apk/debug/
To install the app on a connected device:
For Windows:
.\gradlew.bat installDebugFor macOS/Linux:
./gradlew installDebugThrough 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
- 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.healthcareappto a production-style package name
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.
This project is available for educational and portfolio purposes.