Android development is the process of building applications (apps) for devices running the Android Operating System (OS).
-
Android apps are packaged as APK (Android Package) files
-
APK contains:
- Code
- Resources
- Assets
π Developers upload APKs to the Google Play Store for distribution.
The Android SDK is a collection of tools required to build Android applications.
- Provides APIs, libraries, and debugging tools
- Helps in building, testing, and managing apps
- Fully supported by Google and the developer community
In this course, we will learn:
- Kotlin Programming Language
- Android Studio (IDE)
- Android Ecosystem
- Core Android Components
- Building Real Android Applications
- Publishing Apps on Play Store
Jetpack Compose is a modern toolkit for building native Android UI.
- Less code
- Powerful tools
- Intuitive Kotlin APIs
π UI is created using @Composable functions in Kotlin π No need for XML layouts
Kotlin is a statically typed, open-source programming language.
- Supports OOP + Functional Programming
- Runs on JVM (Java Virtual Machine)
- Interoperable with Java
Similar to Java, C#, and Scala
- Static Language: Variable type is determined at compile time
- Dynamic Language: Variable type is determined at runtime
- Fully interoperable with Java
- Easy conversion between Java β Kotlin
- Built-in Java-to-Kotlin converter in Android Studio
- Less code
- Faster development
- Clean and readable syntax
- Supports Web, Desktop, and Android development
- Package: Organizes related classes
- Class: Blueprint for objects
- Object: Instance of a class (contains properties + functions)
- OOP: Programming based on objects and data
- Function: Reusable block of code
- Parameter/Argument: Value passed to a function
- JDK: Development tools
- JRE: Runtime environment
- JVM: Executes Java/Kotlin programs
Used to arrange UI components:
- Row β Horizontal layout
- Column β Vertical layout
- Box β Stack layout (overlapping elements)
π Main Direction = Arrangement π Cross Direction = Alignment
horizontalArrangementverticalAlignment
verticalArrangementhorizontalAlignment
- Start
- End
- Center
- SpaceBetween
- SpaceAround
- SpaceEvenly
- Top
- CenterVertically
- Bottom
- Top
- Bottom
- Center
- SpaceBetween
- SpaceAround
- SpaceEvenly
- Start
- CenterHorizontally
- End
Spacer is used to create empty space between UI components.
- Fixed space β
width(),height(),size() - Flexible space β
weight()
- Add spacing between elements
- Push components apart
- Control layout spacing
A Button is a clickable UI component used to perform actions.
Button(onClick = { }) {
Text("Click Me")
}onClickβ Action handlermodifierβ Layout & stylingcolorsβ Button colorsenabledβ Enable/disable buttonshapeβ Corner designelevationβ Shadowborderβ Outlinecontentβ UI inside button
TextField is used to take input from the user.
var text by remember { mutableStateOf("") }valueβ Current textonValueChangeβ Updates textlabelβ Hint textmodifierβ Layout controlcolorsβ Styling
When state changes, Compose automatically updates only the affected UI.
π No manual UI refresh required
Modifiers are used to customize UI elements.
Modifier
.fillMaxWidth()
.padding(16.dp)
.background(Color.Gray)π Modifiers can be chained together
Used to display images from different sources:
- Drawable resources
- Bitmap
- Painter
- URL (using libraries like Coil)
paintercontentDescriptionmodifiercontentScalealignment
A CheckBox is a two-state component:
- Checked
- Unchecked
Used for selections and user input.
A Switch in Jetpack Compose is a UI component used to toggle between two states β ON and OFF. It is commonly used in settings screens for enabling or disabling features.
It works using a boolean state (true or false) and updates through the onCheckedChange callback when the user interacts with it.
- Stateful: Manages its own state
- Stateless: Receives state from outside
DropdownMenu is used in Jetpack Compose to display a list of selectable menu items in a popup menu.
expandedβ Controls whether the menu is visible or hidden.onDismissRequestβ Called when the menu should close (outside click/back press).modifierβ Used to style or position the menu.offsetβ Changes the menu position relative to its anchor.propertiesβ Controls additional popup behavior.
DropdownMenuItem represents a single selectable option inside a DropdownMenu.
textβ Displays the content/text of the item.onClickβ Executes when the item is selected.leadingIconβ Adds an icon at the start.trailingIconβ Adds an icon at the end.enabledβ Enables or disables item selection.colorsβ Customizes item colors.contentPaddingβ Adjusts spacing inside the item.
A Toast Message is a small popup message used to show short feedback to the user. It appears for a short time and disappears automatically without user action.
context-> Defines where the Toast will be shown from.- "message" -> The text that is displayed inside the Toast.
- "Duration" -> Defines how long the Toast will be visible.
show()-> Displays the Toast message on the screen.
A Snackbar Message is a message shown at the bottom of the screen to give feedback to the user. It can also include an action button such as Undo, Retry, or Dismiss.
snackbarHostState-> Controls and manages the Snackbar message.SnackbarHost-> Defines the place where the Snackbar will be displayed.message-> The text displayed inside the Snackbar.actionLabel-> Adds an action button inside the Snackbar.- "duration" -> Defines how long the Snackbar will stay visible.
showSnackbar()-> Displays the Snackbar message.- "CoroutineScope" -> Required because
showSnackbar()is a suspend function.
| Toast Message | Snackbar Message |
|---|---|
| Shows a small popup message | Shows a message at the bottom of the screen |
| Cannot have action button | Can have action button |
| Automatically disappears | Can disappear or wait for user action |
| Simple to use | Requires Scaffold, SnackbarHostState, and CoroutineScope |
| Good for small feedback | Good for important feedback |
| Less interactive | More interactive |
| Example: βCopiedβ | Example: βTask deleted β Undoβ |