Mobile Lifecycle and State Restoration Quiz

Four Android-flavored questions on activity lifecycle, configuration changes, and saved-state restoration. Aimed at native Android candidates and at backend devs interviewing onto a mobile-leaning team.

Question Bundle
Java
framework
state-machine
interview-prep
folakemansour

By @folakemansour

December 29, 2025

·

Updated May 20, 2026

588 views

15

4.2 (11)

An Activity holds the user's typed-but-not-submitted form input in a field. When the device rotates, the field resets to empty. Walk me through why, and write the smallest fix using onSaveInstanceState.

Demo

Demo: user types "hello" in the form and rotates the device. Without onSaveInstanceState, draftMessage resets to "" because the config change recreates the Activity and instance fields go with it. With onSaveInstanceState writing KEY_DRAFT and onCreate reading it back from the Bundle, the field shows "hello" after rotation. Same pattern covers font-scale and dark-mode changes.

3 more questions and all solutions are locked.

Purchase this item to access all questions, code snippets, and solutions.