← All courses

Intents & Navigation

🗓 May 31, 2026 ⏱ 1 min read

Explicit intents (open your screen)

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

Read it on the other side:

val userId = intent.getIntExtra("userId", 0)

Implicit intents (ask the system)

// open a website
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://aimobilecoders.com")))
// share text
val share = Intent(Intent.ACTION_SEND).apply {
    type = "text/plain"
    putExtra(Intent.EXTRA_TEXT, "Check this out!")
}
startActivity(Intent.createChooser(share, "Share via"))

The Navigation Component

For multi-screen apps, modern Android uses a single Activity with many Fragments and a navigation graph, instead of many activities.

findNavController().navigate(R.id.action_home_to_profile)
Tip: Pass data safely between destinations using Safe Args generated classes instead of raw bundles.