Understanding the Android activity lifecycle is crucial for developing stable and efficient applications. This quiz will test your knowledge of activity state changes, lifecycle methods, and best practices for handling app state transitions. You’ll also explore how Logcat helps debug and track activity behavior.
1.
Which Logcat filter key restricts the output to only messages related to the current app package?
2.
Which method is called when an activity is being restarted after being stopped?
3.
Which lifecycle method is NOT part of the activity lifecycle but is used for debugging and logging?
4.
What happens when the system needs to reclaim memory and forcefully kills an activity?
5.
Which method should be used to save transient data when an activity is about to be stopped?
6.
Which lifecycle method is called when an activity becomes visible to the user?
7.
Which of the following best describes the primary purpose of Logcat in Android development?
8.
Which method is called when an activity is no longer visible to the user?
9.
What is the purpose of the onDestroy() method?
10.
Which method is called when an activity is first created?
11.
What does the Log.i() method do?
12.
What happens if an activity is destroyed due to a configuration change like screen rotation?
13.
Which method is called when an activity is about to enter the foreground and start interacting with the user?
14.
Which lifecycle method is guaranteed to be called before an activity is destroyed?
15.
Which of the following is NOT a valid activity state?