Back to articles
Day 3/100: Activity Lifecycle β€” The Diagram You've Seen 100 Times
How-ToCareer

Day 3/100: Activity Lifecycle β€” The Diagram You've Seen 100 Times

via Dev.toHoang Son

This is Day 3 of my 100 Days to Senior Android Engineer series. Each post: what I thought I knew β†’ what I actually learned β†’ interview implications. πŸ” The concept Every Android developer has seen this diagram: onCreate() ↓ onStart() ↓ onResume() ←──────────────────────┐ ↓ β”‚ [Activity running] β”‚ ↓ β”‚ onPause() β”‚ ↓ onRestart() onStop() ──────────────────────→ β”‚ ↓ onDestroy() You could draw this in your sleep. I certainly could. The problem is that this diagram shows the happy path . It doesn't show what happens in the three scenarios that actually matter in production β€” and that every senior interview will eventually probe. πŸ’‘ What I thought I knew My mental model was: callbacks fire in a predictable sequence, each one is the right place to do certain things (init in onCreate , release in onDestroy ), and as long as I follow the pattern, everything works. That model is mostly right. Mostly. 😳 What I actually learned The diagram has a ghost: the back stack The standard diagram shows a singl

Continue reading on Dev.to

Opens in a new tab

Read Full Article
7 views

Related Articles