2 minutes reading time
Intents are how Android components—or apps—tell each other to do something, like open a screen, send data, or start a system action. It is more of like sending a letter with the intent mentioned, and Android delivers it where it's supposed to go (opening a camera, navigating around system).
There are two types of intents mainly. Explicit Intents & Implicit intents
explicit intents : starts a specific component (own activity mainly)
Intent intent ;
;
implicit intents : invokes system or third-party actions
Intent intent ;
intent.;
;
Defined in AndroidManifest.xml to allow other apps to call specific components intent filter consists of 3 parts :
"android.intent.action.VIEW")"android.intent.category.DEFAULT")mimeType="text/plain" or scheme="http")some common use cases are sharing text ACTION_SEND, picking image ACTION_PICK, open map ACTION_VIEW.
When using an Intent to start another Activity or Service, you can attach extra data to it using key-value pairs.
attaching data to the intent (sender)
putExtra(key, value) for simple typesputExtras(Bundle) for multiple key-value paris on a single instanceIntent intent ;
intent.;
intent.;
;
this intent now carries "username" = "goober" and "age" = 51
retrieving the data (receiver)
ProfileActivityString username ;
int age ; // -1 = default if not found
adb shell am start to trigger intents with manual ----------Passing data with Intent extras is like slipping notes between Android components — just don’t forget the key, or your app’s memory might ghost you.