0
0
Android Kotlinmobile~5 mins

Activity concept in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is an Activity in Android?
An Activity is a single screen in an Android app where the user interacts. It controls the UI and handles user actions.
Click to reveal answer
beginner
Which method is called when an Activity is first created?
The onCreate() method is called when the Activity is first created. It is where you set up the UI and initialize components.
Click to reveal answer
intermediate
Name two lifecycle methods called when an Activity becomes visible and when it goes to the background.
onStart() is called when the Activity becomes visible. onStop() is called when the Activity is no longer visible (goes to background).
Click to reveal answer
beginner
How do you start a new Activity from the current Activity?
You create an Intent specifying the new Activity class and call startActivity(intent) to open it.
Click to reveal answer
intermediate
What is the purpose of the onPause() method in an Activity?
onPause() is called when the Activity is partially obscured or about to go into the background. Use it to pause animations or save data.
Click to reveal answer
Which method is NOT part of the Activity lifecycle?
AonClick()
BonStart()
ConCreate()
DonDestroy()
What does the onResume() method indicate?
AActivity is visible and interacting with the user
BActivity is being created
CActivity is stopped
DActivity is destroyed
How do you open a new Activity named DetailActivity?
AopenActivity(DetailActivity)
BstartActivity(Intent(this, DetailActivity::class.java))
Claunch(DetailActivity)
Dnew Activity(DetailActivity)
Which lifecycle method should you use to save user data before the Activity is stopped?
AonCreate()
BonStart()
ConPause()
DonResume()
What happens when you call finish() inside an Activity?
ANothing happens
BThe Activity restarts
CThe Activity pauses
DThe Activity closes and is removed from the stack
Explain the Android Activity lifecycle and why it is important.
Think about what happens when the user opens, uses, and leaves an Activity.
You got /8 concepts.
    Describe how to navigate from one Activity to another in Android.
    Consider how you tell Android to show a new screen.
    You got /4 concepts.