Android Application Development (AND-401) — Question 45
Which of the following Activity life-cycle methods is invoked when a dialog is shown?
Answer options
- A. onPause()
- B. onCreate()
- C. onStop()
- D. onDestroy()
Correct answer: A
Explanation
The onPause() method is called when a dialog is displayed, as it indicates that the activity is partially obscured. The other methods, such as onCreate(), onStop(), and onDestroy(), are related to different stages of the activity life-cycle and are not specifically triggered by the presence of a dialog.