Intents & Navigation

June 02, 2026 1 min read

An Intent is a message that asks the system to do something — usually "open this screen" or "open the dialer / share this text".

Explicit Intent — open your own screen

val intent = Intent(this, DetailActivity::class.java)
intent.putExtra("userId", 42)
startActivity(intent)

// In DetailActivity:
val id = intent.getIntExtra("userId", -1)

Implicit Intent — let any app handle it

val share = Intent(Intent.ACTION_SEND).apply {
    type = "text/plain"
    putExtra(Intent.EXTRA_TEXT, "Check this out!")
}
startActivity(Intent.createChooser(share, "Share via"))

Modern navigation

For multi-screen apps the Navigation Component (or Compose Navigation) is preferred — it centralises screen flow in a graph and handles the back stack for you.

Tip: Pass small data via Intent extras; pass IDs (not whole objects) and load details on the next screen.

Summary

Intents launch screens and trigger system actions. Use explicit intents inside your app and implicit intents to reuse other apps.