A modern, animated Android application for calculating Body Mass Index (BMI) with a beautiful user interface and smooth animations.
- BMI Calculation: Calculate BMI using weight and height inputs
- Multiple Unit Support:
- Weight: kg, pounds, stones
- Height: cm, feet, meters
- Real-time Conversion: Automatic unit conversion for accurate calculations
- BMI Categories: Visual reference table showing BMI classifications
- Animated Splash Screen: Lottie animations for engaging user experience
- Modern Design: Purple/blue gradient theme with semi-transparent elements
- Responsive Layout: Optimized for different screen sizes
- Smooth Animations: Background Lottie animations for visual appeal
BMI Range | Category | Color |
---|---|---|
≤ 18.4 | Underweight | Light Yellow |
18.5 - 24.9 | Normal | Green |
25.0 - 39.9 | Overweight | Orange |
≥ 40.0 | Obese | Red |
main.mp4
- Language: Java
- Minimum SDK: API 24 (Android 7.0)
- Target SDK: API 34 (Android 14)
- Compile SDK: API 35
- Architecture: Single Activity with Splash Screen
- UI Framework: ConstraintLayout
- Animations: Lottie (Airbnb)
- Build System: Gradle
- Android Studio Arctic Fox or later
- Android SDK API 24+
- Java Development Kit (JDK) 11
- Gradle 8.9+
git clone https://github.com/yourusername/bmi-calculator.git
cd bmi-calculator
- Open Android Studio
- Select "Open an existing Android Studio project"
- Navigate to the cloned directory and select it
- Wait for Gradle sync to complete
- If prompted, update Gradle wrapper version
- Connect an Android device or start an emulator
- Click the "Run" button (green play icon) or press
Shift + F10
app/
├── src/main/
│ ├── java/com/harsh/bmi/
│ │ ├── MainActivity.java # Main BMI calculation logic
│ │ └── SplashActivity.java # Animated splash screen
│ ├── res/
│ │ ├── layout/
│ │ │ ├── activity_main.xml # Main UI layout
│ │ │ └── activity_splash.xml # Splash screen layout
│ │ ├── values/
│ │ │ ├── strings.xml # String resources
│ │ │ ├── colors.xml # Color definitions
│ │ │ └── themes.xml # App themes
│ │ ├── drawable/ # Custom drawables
│ │ └── raw/ # Lottie animation files
│ └── AndroidManifest.xml
└── build.gradle.kts # App-level build configuration
- Handles BMI calculation logic
- Manages unit conversions (feet to meters, pounds to kg, etc.)
- Implements input validation
- Controls UI state and visibility
- Provides animated splash screen
- Uses Lottie animations for smooth transitions
- Implements proper splash screen lifecycle management
- activity_main.xml: Complex ConstraintLayout with multiple Lottie animations
- activity_splash.xml: Full-screen splash with centered animation
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.4'
implementation 'androidx.core:core-splashscreen:1.0.0'
implementation 'com.airbnb.android:lottie:6.4.0'
}
- Launch the App: The app starts with an animated splash screen
- Enter Measurements:
- Input your weight in the first field
- Select weight unit (kg/pounds/stones)
- Input your height in the second field
- Select height unit (cm/feet/meters)
- Calculate BMI: Tap the "BMI" button
- View Results: Your BMI value and category will be displayed
- Reference Table: Use the built-in BMI categories table for interpretation
The app uses the standard BMI formula:
BMI = weight (kg) / height (m)²
The app automatically handles these conversions:
- Height: feet → meters (× 0.3048), cm → meters (÷ 100)
- Weight: pounds → kg (× 0.453592), stones → kg (× 6.35029)