Overview
MainActivity is the primary activity component that serves as the entry point for the Voice to Text Android application. It extends ComponentActivity and sets up the app’s UI using Jetpack Compose.
Class definition
Methods
onCreate
Initializes the activity and sets up the Compose UI hierarchy.Contains the activity’s previously saved state, or null if this is a newly created activity.
Implementation details
TheonCreate method performs the following operations:
- Edge-to-edge display - Enables edge-to-edge rendering for a modern, immersive UI experience
- Theme application - Wraps the UI in
VoiceTotextThemefor consistent Material Design styling - Scaffold setup - Uses Material 3
Scaffoldwith a top app bar and content area - Content composition - Renders the
VoiceRecognitionScreenwith appropriate padding
The
enableEdgeToEdge() function call ensures that your app’s content extends behind system bars for a modern, immersive experience.Dependencies
This class depends on the following components:VoiceRecognitionScreen- The main composable that handles voice recognition functionalityAppBar- The top app bar composable that displays the app titleVoiceTotextTheme- The custom theme that provides Material Design styling