Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
The Fundamentals  ›  Capstone Project

Hello World — Sprout's First Screen

Create a Basic Hello World App 15 minA minimal app is one activity, declared in the manifest as the launcher entry point, that sets its content when it is created.

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.

Tapping Sprout's iconStep 1 of 4
  1. 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.

quick drill

Which intent-filter entries make an activity show up as an icon in the app drawer?

quick drill

Who calls MainActivity.onCreate?

quick drill

What does setContent { Text("Hello, Sprout!") } do?

quick drill

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.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainFrom icon tap to text

Describe everything that happens, in order, from the moment a user taps Sprout's icon to the moment "Hello, Sprout!" appears. Name the manifest entry and the function involved.