Android Development with Kotlin: The Concepts That Finally Make It Click

Android development throws a lot at you: Activities, Fragments, Intents, Gradle, ViewModels, LiveData, and now Jetpack Compose. The problem isn’t that it’s hard. It’s that nobody explains how the pieces connect.

The Mental Model

Think of an Android app as three layers:

  • UI layer: what the user sees (Compose UI / XML layouts)
  • State layer: what the UI depends on (ViewModel)
  • Data layer: where data comes from (Room DB, network API)

Activities and Intents

An Activity is a screen. An Intent is a message: “open this screen” or “perform this action.”

// Navigate to a new screen
val intent = Intent(this, ProfileActivity::class.java)
startActivity(intent)

Why ViewModels Matter

Without ViewModels, your data can be destroyed on rotation or process death. ViewModels keep state alive across configuration changes.

class ProfileViewModel : ViewModel() {
    private val _name = MutableStateFlow("")
    val name: StateFlow<String> = _name

    fun loadProfile() {
        // fetch data, update _name
    }
}

Compose (The Modern UI)

Compose is declarative UI. You describe what the UI should look like for a given state.

@Composable
fun ProfileScreen(vm: ProfileViewModel) {
    val name by vm.name.collectAsState()
    Text(text = "Hello, $name")
}

My Recommendation for Beginners

  1. Learn Kotlin basics (null safety, data classes, coroutines)
  2. Build 2-3 simple Compose screens
  3. Add ViewModel and StateFlow
  4. Add Room database for persistence
  5. Call a real API with Retrofit

Android becomes enjoyable once you stop memorizing components and start thinking in layers: UI  state  data. That one mental model will carry you a long way.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top