Knowledgebase

Android Activities and Navigation Print

  • mobiledevelopment, mobile, themes, guide, howto, solution, zillionkinghost, hosting
  • 0

Moving between screens.

WHAT AN ACTIVITY LIFECYCLE INVOLVES

Creation, becoming visible, becoming active, losing focus, becoming hidden, and destruction.

WHAT TRIGGERS DESTRUCTION AND RECREATION

Rotation Language or theme changes The system reclaiming memory

WHY THAT MATTERS

Any state held only in the activity is lost.

WHAT TO DO ABOUT IT

Hold state where it survives recreation, and save anything else explicitly.

WHAT THE BACK STACK IS

The history of screens, which the back gesture moves through.

WHAT TO ENSURE

That back behaves as the user expects, from any entry point.

WHY FROM ANY ENTRY POINT

A notification or a link may open a deep screen directly, with no history behind it.

WHAT TO DO ABOUT THAT

Construct an appropriate back stack, or define where back goes.

WHAT MODERN NAVIGATION PROVIDES

Declared destinations and transitions, with argument passing and back stack handling.

WHAT TO AVOID

Deep nesting of screens Screens that cannot be reached directly Navigation that loses state

WHAT TO TEST

Entering every screen directly, then pressing back.


Was this answer helpful?
Back

Are you happy with your experience? Leave us a review on Trustpilot.


Trustpilot