An Android application that calculates Body Mass Index (BMI) using Kotlin and Jetpack Compose.
This application calculates a user's BMI based on their height (in meters) and weight (in kilograms) using the formula: BMI = weight / (height * height).
The app features:
- Input fields for height and weight
- Real-time BMI calculation
- BMI classification display (Underweight, Normal weight, Overweight, Obesity)
- Color-coded classification results
The project demonstrates the MVVM (Model-View-ViewModel) architecture pattern:
- UI components built with Jetpack Compose
- ViewModel to manage UI state and business logic
- State management using mutableStateOf
Initial implementation without proper architecture.
Refactored version using proper MVVM architecture.
- ViewModel: Handles state management and BMI calculations
- Compose UI: Modern declarative UI implementation
- Data Validation: Proper handling of decimal inputs and empty values
- BMI Classification: Classification based on WHO standards
- Underweight: BMI < 18.5
- Normal weight: 18.5 ≤ BMI < 25.0
- Overweight: 25.0 ≤ BMI < 30.0
- Obesity (Class 1): 30.0 ≤ BMI < 35.0
- Obesity (Class 2): 35.0 ≤ BMI < 40.0
- Obesity (Class 3): BMI ≥ 40.0