Name the main Activity lifecycle callbacks.onCreate, onStart, onResume, onPause, onStop, and onDestroy. When returning from a stopped state, onRestart precedes onStart. Process death does not guarantee the final callbacks. Lifecycle.
What does a ViewModel survive?It survives Activity recreation for a configuration change when obtained through the retained owner. The instance does not survive process death; saved state can reconstruct selected values in a new instance. ViewModel.
Is onDestroy guaranteed to run?No. A killed process cannot run cleanup callbacks. Persist important changes while the app is active rather than keeping the only copy until destruction. Save UI states.
Activity A opens a full-screen Activity B. What changes?When B is launched in front of A, A.onPause must return before B is created. A new B passes through onCreate, onStart and onResume; A receives onStop when it is no longer visible. Do not treat this as a universal trace for transparency, multi-window, Activity reuse or finish. Saving state has separate rules. Activity.onPause, visibility and lifecycle.