Hello World — Sprout's First Screen
Time to put something on the screen. A Hello World app looks tiny, but it contains the three pieces every Android app is built on: a manifest entry, an activity, and some content. Understand these and every later lesson slots into place.
The rule
The manifest points to the door; onCreate paints the room.
First, the manifest declares an activity and marks it as the app's entry point:
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>MAIN means "this is where the app starts" and LAUNCHER means "show an icon for it in the app drawer". exported="true" lets the launcher, which is another app, open it.
Second, the activity sets its content when it is created:
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Text("Hello, Sprout!")
}
}
}onCreate is called by the system, not by you. setContent takes a composable, here a single Text, and makes it the screen.
The shortcut
Trace the launch as tap → find → create → paint.
Tap
The user taps the Sprout icon in the launcher.
If the app installs but no icon appears, check the filter first: a missing LAUNCHER category is the usual cause. If opening a screen crashes with "unable to find explicit activity class", that activity is missing from the manifest.
To run it, create an emulator in the Device Manager (or plug in a phone with USB debugging on) and press Run.
Drills
Answer fast — trust the rule.
Which intent-filter entries make an activity show up as an icon in the app drawer?
Who calls MainActivity.onCreate?
What does setContent { Text("Hello, Sprout!") } do?
Tapping a plant crashes Sprout with "unable to find explicit activity class". What is the most likely fix?
Remember
- The manifest points to the door; onCreate paints the room.
- Trace a launch as tap → find → create → paint.
- No icon? Check
MAIN+LAUNCHER. Crash on start? Check the manifest entry.
