The objective of this project is to build an Android application that allows users to convert values between different units of measurement, such as length (meters, centimeters, kilometers, inches, feet), weight (grams, kilograms, pounds, ounces), and temperature (Celsius, Fahrenheit, Kelvin). The app provides a simple and intuitive interface where users select a category and units, enter a value, and instantly see the converted result.
- Android Studio — IDE used for development
- Java — Programming language used for application logic
- XML — Used for designing the user interface
- CardView — Used for a modern, card-based UI layout
- Created a new Android Studio project using the Empty Views Activity template with Java as the language.
- Designed the user interface in
activity_main.xmlusingConstraintLayout/LinearLayoutinside aScrollView, withSpinnerdropdowns for category and unit selection, anEditTextfor value input, andCardViewcomponents for a clean, modern look. - Implemented the conversion logic in
MainActivity.java:- Defined conversion factors for each unit relative to a base unit (e.g., meters for length, grams for weight).
- Handled temperature conversion separately using standard formulas, since temperature conversions are not simple multiplicative ratios.
- Added dynamic spinner population so that unit options update automatically based on the selected category.
- Added input validation to handle empty fields gracefully.
- Formatted the output result to avoid unnecessary trailing zeros (e.g., displaying
5instead of5.0000). - Tested the application on an Android emulator (Medium Phone API 36.1) to verify accurate conversions across all three categories.
The application successfully converts values across Length, Weight, and Temperature categories with accurate results. It features a clean, card-based Material Design-inspired UI with a purple color theme, clear input/output sections, and a responsive layout. The app correctly handles edge cases like empty input and displays clean, readable results without unnecessary decimal places.
- Clone this repository.
- Open the project folder in Android Studio.
- Let Gradle sync complete.
- Run the app on an emulator or physical Android device (minimum SDK 24).