An Android calculator application implementing basic and scientific mathematical operations with custom expression parsing.
- Basic arithmetic operations (addition, subtraction, multiplication, division)
- Scientific functions (trigonometric, logarithmic, exponential)
- Expression parsing with operator precedence and parentheses
- Multiple numbering system support (international, Arabic-Indic, etc.)
- Calculation history with persistent storage
- Theme configuration (light, dark, AMOLED)
- Precision control for decimal output
- Scientific notation support
- Quick Settings tile integration
Here are a few screens to give you a quick feel for the app:
- Language: Kotlin
- Platform: Android (API 21-34)
- Build System: Gradle with Kotlin DSL
- UI: Android Views with View Binding
- Architecture: Activity-based with service components
- Mathematical expression evaluation using
BigDecimalfor precision - Supports trigonometric, logarithmic, and exponential functions
- Handles special cases (division by zero, domain errors, syntax errors)
- Converts user input into evaluable mathematical expressions
- Handles symbol substitution (× → *, ÷ → /)
- Manages operator precedence and parentheses
- Formats percentage calculations
- JSON-based storage using Gson
- Persistent calculation records with timestamps
- Configurable history limits
app/src/main/
├── java/com/android/calculator/
│ ├── activities/ # Activity classes (MainActivity, SettingsActivity, AboutActivity)
│ ├── calculator/ # Core calculation logic
│ │ ├── Calculator.kt # Mathematical operations implementation
│ │ └── parser/ # Expression parsing utilities
│ ├── history/ # Calculation history management
│ ├── services/ # Background services (Quick Settings tile)
│ └── util/ # Utility classes (theme, preferences, scientific mode)
└── res/ # Android resources (layouts, values, drawables)
- Android Studio Hedgehog (2023.1.1) or later
- JDK 8 or higher
- Android SDK with API 34
- Gradle 8.0+
Clone the repository and build using the Gradle wrapper.
Windows (PowerShell/CMD):
REM Clone repository
git clone https://github.com/HRG-OFFICIAL/Android-Calculator.git
cd Android-Calculator
REM Build debug APK
gradlew.bat assembleDebug
REM Install on connected device
gradlew.bat installDebug
REM Run unit tests
gradlew.bat testDebugUnitTest
REM Run instrumented tests
gradlew.bat connectedAndroidTestmacOS/Linux (bash/zsh):
# Clone repository
git clone https://github.com/HRG-OFFICIAL/Android-Calculator.git
cd Android-Calculator
# Build debug APK
./gradlew assembleDebug
# Install on connected device
./gradlew installDebug
# Run unit tests
./gradlew testDebugUnitTest
# Run instrumented tests
./gradlew connectedAndroidTest- Arithmetic:
+,-,×,÷ - Exponentiation:
^,E(scientific notation) - Functions:
sin,cos,tan,ln,log,log₂,√,! - Constants:
π,e - Parentheses for precedence control
- Configurable decimal places (0-15)
- Scientific notation toggle
- Rounding mode: HALF_UP
Unit tests are located in app/src/test/java/ and cover:
- Expression parsing
- Mathematical operations
- Edge cases (division by zero, invalid operations)
Run tests:
./gradlew testVIBRATE: Haptic feedback on button pressesSYSTEM_ALERT_WINDOW: Display overlay for quick accessUSE_FULL_SCREEN_INTENT: Quick Settings tile functionality
If you find this project useful and would like to support its development, you can:
- Star this repository
- Report bugs or suggest features
- Buy me a coffee to support continued development
This project is licensed under the MIT License - see LICENSE file for details.





