Join our Newsletter — 33% off our NHI Course
Home› Glossary› Architecture & Implementation› Android Activity Lifecycle
Architecture & Implementation

Android Activity Lifecycle

← Back to Glossary
By NHI Mgmt Group Updated November 3, 2026 Domain: Architecture & Implementation

Android Activity Lifecycle is the sequence of states and callback methods an Android activity passes through from creation to destruction. It includes transitions such as created, started, resumed, paused, stopped and destroyed, and governs when the app should initialise UI, save state or release resources.

What the Android activity lifecycle is responsible for

The Android activity lifecycle is the operating model that tells an activity when it exists, when it is visible, when it can interact with the user, and when it should preserve or release state. Each callback marks a transition that lets the app coordinate UI setup, foreground behaviour, pause handling, and cleanup in a way the Android runtime can manage predictably.

This matters because lifecycle transitions are not just bookkeeping. They determine when screen state is safe to read or write, when background work should stop, and when the app should avoid assuming the user can still see or trust the current screen.

Lifecycle callbacks and state transitions

The lifecycle is usually described through states such as created, started, resumed, paused, stopped, and destroyed, with callbacks such as onCreate(), onStart(), onResume(), onPause(), onStop(), and onDestroy(). These callbacks are not arbitrary events, they are the app's signals for when to initialise, refresh, suspend, or tear down activity-specific work.

In practice, the sequence is rarely perfectly linear from a developer's point of view. Configuration changes, task switching, multi-window behaviour, and process death can all cause an activity to move through lifecycle states in ways that expose assumptions in the code if state handling is incomplete.

Why lifecycle handling affects app correctness

Correct lifecycle handling is what keeps a mobile app responsive and stable as the user moves between screens, backgrounds the app, or returns after interruption. If the app initialises UI too early or releases resources too late, the result can be stale screens, lost input, duplicated work, or crashes that only appear under real device conditions.

Lifecycle-aware code also helps the app preserve continuity. State that belongs in memory, state that belongs in persistent storage, and state that should be recreated on demand each have different timing requirements, and the lifecycle determines when each of those choices is safe.

Common implementation patterns and developer responsibilities

Developers typically use the lifecycle to separate one-time setup from visible-screen work and teardown. A sensible implementation keeps heavy initialisation out of the busiest UI path, places transient listeners and observers where they can be attached and removed cleanly, and saves user-facing state before the activity can be paused or stopped unexpectedly.

For mobile security and hardening guidance around adjacent risks such as activity hijack, intent spoofing, and insecure mobile component behaviour, see Mobile App Security Guide. The lifecycle is one of the places where those failures become visible because component handoff and state transitions can expose trust assumptions.

Risk and Threat Considerations

Lifecycle mistakes become security issues when they let an attacker, another app, or an unexpected transition influence what the user sees or what state the app preserves. The main risk is not the callback itself, but the trust boundary it creates between foreground activity, background activity, and restored state.

Failure mechanism: If sensitive UI state, intents, or task transitions are handled incorrectly, an attacker can exploit activity re-entry, task spoofing, or stale state restoration to confuse the user or influence the app's behaviour.

Impact: The result can be credential exposure, unwanted navigation, unintended actions, or a weakened security posture in flows that depend on the activity being the current trusted screen.

Standards & Framework Alignment

This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.

OWASP API Security Top 10 addresses the attack and risk surface, while OWASP ASVS, CIS Controls v8 and NIST SP 800-53 Rev 5 set the governance and control requirements practitioners need to meet.

FrameworkControl / ReferenceRelevance
OWASP ASVSV15 — Secure Coding and ArchitectureLifecycle-aware state handling is part of secure mobile app architecture.
Recommendation — Design activity state handling to avoid stale data, unsafe transitions, and brittle lifecycle assumptions.
CIS Controls v8CIS-16 — Application Software SecurityMobile lifecycle bugs are application security weaknesses that need secure design and review.
Recommendation — Review activity callbacks for state loss, unsafe transitions, and component misuse before release.
NIST SP 800-53 Rev 5SC-39 — Process IsolationActivity boundaries and task separation depend on isolating security-relevant app state.
AU-12 — Audit Record GenerationLifecycle events and state changes can be logged to support troubleshooting and security review.
Recommendation — Limit cross-process and cross-component exposure when activities handle sensitive state. Log significant lifecycle transitions where they affect access, state, or sensitive user flows.
OWASP API Security Top 10API8 — Security MisconfigurationMisconfigured app components can make lifecycle-driven transitions unsafe or exploitable.
Recommendation — Harden exported components and transition paths so lifecycle changes do not expose unsafe entry points.

Practitioner Guidance

What to watch for: Treat the lifecycle as a control surface, not just a framework pattern. Review whether every callback does only the work appropriate to that state, especially around state restoration, screen transitions, and cleanup of sensitive in-memory data.

Practitioner takeaway: The safest Android code usually depends less on memorising callback order and more on making each state transition explicit, idempotent, and resilient to interruption.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

NHIMG Editorial Note
Reviewed and updated by the NHIMG editorial team on November 3, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org