Challenge - 5 Problems
Transition Animation Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ ui_behavior
intermediate2:00remaining
What is the output of this transition animation code?
Consider this Kotlin code snippet for an Android app that starts a new activity with a fade animation. What will the user see when the new activity starts?
Android Kotlin
val intent = Intent(this, SecondActivity::class.java)
startActivity(intent)
overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out)Attempts:
2 left
💡 Hint
Look at the animation resource IDs used in overridePendingTransition.
✗ Incorrect
The android.R.anim.fade_in and fade_out resources create a smooth fade transition between activities.
❓ lifecycle
intermediate2:00remaining
When does the transition animation start in the activity lifecycle?
In Android, at which point in the activity lifecycle does the transition animation triggered by overridePendingTransition() begin?
Attempts:
2 left
💡 Hint
Think about when the system switches the UI to the new activity.
✗ Incorrect
The transition animation starts immediately after startActivity() is called, before the new activity's onCreate() method.
🔧 Debug
advanced2:00remaining
Why does this transition animation not work as expected?
This code is intended to slide the new activity in from the right, but the animation does not run. What is the problem?
Android Kotlin
val intent = Intent(this, NextActivity::class.java)
startActivity(intent)
overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_left)Attempts:
2 left
💡 Hint
Check if the animation resource files exist and are valid XML.
✗ Incorrect
If the animation XML files are missing or invalid, the animation will not run and the transition will be instant.
advanced
2:00remaining
How to apply a shared element transition between two activities?
You want to animate an image smoothly from one activity to another using a shared element transition. Which code snippet correctly starts the new activity with this transition?
Attempts:
2 left
💡 Hint
Shared element transitions require passing the shared view and a transition name.
✗ Incorrect
ActivityOptionsCompat.makeSceneTransitionAnimation with the shared view and transition name enables the shared element animation.
🧠 Conceptual
expert2:00remaining
What is the effect of calling overridePendingTransition(0, 0)?
In an Android app, what happens if you call overridePendingTransition(0, 0) immediately after startActivity()?
Attempts:
2 left
💡 Hint
0 means no animation resource is specified.
✗ Incorrect
Passing 0 for both enter and exit animations disables the transition animations, so the switch is instant.