0
0
Android Kotlinmobile~10 mins

Activity results in Android Kotlin - UI Render Trace

Choose your learning style9 modes available
Component - Activity results

This UI component demonstrates how one Android activity starts another and receives a result back. It shows a button that opens a second screen, and when the user finishes there, the first screen displays the returned message.

Widget Tree
ActivityResultActivity
├── ConstraintLayout
│   ├── Button (Start Second Activity)
│   └── TextView (Result Display)
The root is the ActivityResultActivity which uses a ConstraintLayout as the main container. Inside it, there is a Button that the user taps to open the second activity. Below the button, a TextView shows the result returned from the second activity.
Render Trace - 5 Steps
Step 1: ActivityResultActivity
Step 2: Button (Start Second Activity)
Step 3: SecondActivity
Step 4: SecondActivity Submit Button
Step 5: ActivityResultActivity
State Change - Re-render
Trigger:User taps the button to start second activity and submits a result
Before
TextView is empty, no result shown
After
TextView shows the returned message from second activity
Re-renders:The TextView displaying the result is updated and re-rendered
UI Quiz - 3 Questions
Test your understanding
What happens when the user taps the 'Start Second Activity' button?
AThe app closes immediately
BThe app opens the second activity expecting a result
CThe text in TextView changes to 'Hello'
DNothing happens
Key Insight
Using activity results allows one screen to get information back from another screen, enabling smooth user flows like forms or selections. The UI updates only the part showing the result, keeping the app responsive and clear.