Home

returntoactivity

Return to activity, often written as returntoactivity or return-to-activity, is a navigation pattern in software design where a subtask or child screen returns control to a designated parent screen after completion. The goal is to preserve user context, manage the navigation stack, and avoid creating redundant instances of the parent.

In Android, the pattern is commonly implemented by starting a child activity for a result and returning

Across platforms, similar concepts exist. In iOS, unwind segues serve a related purpose by returning to a

Considerations include ensuring the correct return data, handling configuration changes, and maintaining a predictable back stack.

with
data
when
the
task
completes.
The
parent
activity
can
declare
its
relationship
to
the
child
in
the
manifest
(android:parentActivityName)
to
support
proper
Up
navigation.
The
child
finishes
by
calling
setResult
with
a
result
code
and
optional
data,
then
finish()
to
return
to
the
parent.
The
parent
receives
the
outcome
via
onActivityResult
(legacy)
or
the
modern
Activity
Result
API
(registerForActivityResult)
and
can
react
accordingly,
such
as
updating
UI
or
proceeding
to
the
next
step.
Developers
may
also
use
flags
like
FLAG_ACTIVITY_CLEAR_TOP
to
avoid
creating
multiple
instances
of
the
parent
when
appropriate.
previous
view
controller.
Web
applications
may
use
history.back()
or
navigate
to
a
parent
route
while
carrying
state.
The
return-to-activity
pattern
supports
linear
user
flows,
such
as
from
a
task
initiation
screen
back
to
a
dashboard,
while
preserving
state
and
intention.
Mismanagement
can
lead
to
lost
state
or
confusing
navigation.
See
also:
Android
activity
lifecycle,
Activity
Result
API,
unwind
segues,
and
navigation
patterns.