Junior — Middle
What steps are needed to launch a new screen in an Android application?
sobes.tech AI
Answer from AI
To launch a new screen (Activity) in Android, you need to:
- Create a new class that inherits from
ActivityorAppCompatActivity. - Add the description of the new Activity to the
AndroidManifest.xmlfile. - In the code of the current Activity, create an
Intentpointing to the new screen. - Call the
startActivity(intent)method to launch the new screen.
Example:
// Create an Intent
val intent = Intent(this, NewActivity::class.java)
// Launch the new screen
startActivity(intent)
This is the basic way to transition between screens in Android.