Skip to content

Commit eb69126

Browse files
asolovayAndroid (Google) Code Review
authored andcommitted
Merge "DO NOT MERGE" into klp-modular-docs
2 parents 170556f + 8e4ff7f commit eb69126

File tree

2 files changed

+36
-3
lines changed

2 files changed

+36
-3
lines changed

docs/html/guide/topics/manifest/activity-element.jd

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,14 +453,30 @@ Similarly, a new instance of a "{@code singleTop}" activity may also be
453453
created to handle a new intent. However, if the target task already has an
454454
existing instance of the activity at the top of its stack, that instance
455455
will receive the new intent (in an
456-
<code>{@link android.app.Activity#onNewIntent onNewIntent()}</code> call);
456+
{@link android.app.Activity#onNewIntent onNewIntent()} call);
457457
a new instance is not created.
458458
In other circumstances &mdash; for example, if an existing instance of the
459459
"{@code singleTop}" activity is in the target task, but not at the top of
460460
the stack, or if it's at the top of a stack, but not in the target task
461461
&mdash; a new instance would be created and pushed on the stack.
462462
</p>
463463

464+
<p>Similarly, if you
465+
<a href="{@docRoot}training/implementing-navigation/ancestral.html">navigate
466+
up</a> to an activity on the current stack, the behavior is determined by the
467+
parent activity's launch mode. If the parent activity has launch mode {@code
468+
singleTop} (or the <code>up</code> intent contains {@link
469+
android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}), the parent is brought to the
470+
top of the stack, and its state is preserved. The navigation intent is received
471+
by the parent activity's {@link android.app.Activity#onNewIntent onNewIntent()}
472+
method. If the parent activity has launch mode {@code standard} (and the
473+
<code>up</code> intent does not contain {@link
474+
android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}), the current activity and its
475+
parent are both popped off the stack, and a new instance of the parent activity
476+
is created to receive the navigation intent.
477+
</p>
478+
479+
464480
<p>
465481
The "{@code singleTask}" and "{@code singleInstance}" modes also differ from
466482
each other in only one respect: A "{@code singleTask}" activity allows other

docs/html/training/implementing-navigation/ancestral.jd

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,25 @@ android.support.v4.app.NavUtils} class's static method,
133133
navigateUpFromSameTask()}. When you call this method, it finishes the current activity and
134134
starts (or resumes) the appropriate parent activity.
135135
If the target parent activity is in the task's back stack, it is brought
136-
forward as defined by {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}.</p>
136+
forward. The way it is brought forward depends on whether the parent activity
137+
is able to handle an {@link
138+
android.app.Activity#onNewIntent onNewIntent()} call:</p>
139+
140+
<ul>
141+
<li>If the parent activity has launch mode <a
142+
href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">{@code
143+
&lt;singleTop>}</a>, or the <code>up</code> intent contains {@link
144+
android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}, the parent activity is
145+
brought to the top of the stack, and receives the intent through its
146+
{@link android.app.Activity#onNewIntent onNewIntent()} method.</li>
147+
148+
<li>If the parent activity has launch mode <a
149+
href="{@docRoot}guide/topics/manifest/activity-element.html#lmode">{@code
150+
&lt;standard>}</a>, and the <code>up</code> intent does not contain
151+
{@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP}, the parent activity
152+
is popped off the stack, and a new instance of that activity is created on
153+
top of the stack to receive the intent.</li>
154+
</ul>
137155

138156
<p>For example:</p>
139157

@@ -157,7 +175,6 @@ activity was started in a task that belongs to a different app, then
157175
navigating <em>Up</em> should create a new task that belongs to your app, which
158176
requires that you create a new back stack.</p>
159177

160-
161178
<h3 id="BuildBackStack">Navigate up with a new back stack</h3>
162179

163180
<p>If your activity provides any <a

0 commit comments

Comments
 (0)