Cracking Android SDE2/SDE3 Interviews in 2026: Deep Dives, Code, Follow-ups
Lifecycle & Components 1. Activity lifecycle states? Interviewer: Walk me through the full Activity lifecycle and where you’d place data syncs. Candidate: Absolutely. The Activity lifecycle defines how Android creates, displays, pauses, and destroys a screen. Correct usage ensures good performance, no leaks, and a smooth user experience. onCreate() Called once when the Activity is created. Used for one-time initialization such as: Dependency injection (Hilt) Initializing ViewModels Setting the UI with setContentView() or setContent {} The UI is not yet visible, so no user interaction or heavy work should start here. onStart() The Activity becomes visible to the user but is not yet interactive. This is a good place to prepare UI-related resources or start observing data. onResume() The Activity is in the foreground and fully interactive . This is the best place to: Start sensors, camera, or location updates Perform foreg...