Add AppNavigation demo

This demo illustrates the use of the new support library functionality
for navigating within and across tasks using "up" navigation. This
matches the recommendations in the Android design guide.

Change-Id: I2b36c962dd24f0e0f3b3ee3f86319dafc2fc66e2
diff --git a/build/sdk.atree b/build/sdk.atree
index b1b313b..f380cd4 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -159,6 +159,7 @@
 development/samples/ActionBarCompat            samples/${PLATFORM_NAME}/ActionBarCompat
 development/samples/AndroidBeamDemo            samples/${PLATFORM_NAME}/AndroidBeamDemo
 development/samples/ApiDemos                   samples/${PLATFORM_NAME}/ApiDemos
+development/samples/AppNavigation              samples/${PLATFORM_NAME}/AppNavigation
 development/samples/BackupRestore              samples/${PLATFORM_NAME}/BackupRestore
 development/samples/BasicGLSurfaceView         samples/${PLATFORM_NAME}/BasicGLSurfaceView
 development/samples/BluetoothChat              samples/${PLATFORM_NAME}/BluetoothChat
diff --git a/samples/AppNavigation/Android.mk b/samples/AppNavigation/Android.mk
new file mode 100644
index 0000000..758201e
--- /dev/null
+++ b/samples/AppNavigation/Android.mk
@@ -0,0 +1,19 @@
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples tests
+
+LOCAL_SRC_FILES := $(call all-java-files-under, src)
+
+LOCAL_PACKAGE_NAME := AppNavigation
+
+LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
+
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
+
+LOCAL_PROGUARD_FLAG_FILES := proguard.flags
+
+# Use the following include to make our test apk.
+include $(call all-makefiles-under,$(LOCAL_PATH))
diff --git a/samples/AppNavigation/AndroidManifest.xml b/samples/AppNavigation/AndroidManifest.xml
new file mode 100644
index 0000000..135016e
--- /dev/null
+++ b/samples/AppNavigation/AndroidManifest.xml
@@ -0,0 +1,116 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<manifest android:versionCode="1"
+        android:versionName="1"
+        xmlns:android="http://schemas.android.com/apk/res/android"
+        package="com.example.android.appnavigation">
+
+    <uses-sdk android:minSdkVersion="8" android:targetSdkVersion="15" />
+
+    <application android:label="@string/app_name">
+        <activity android:name=".app.AppNavHomeActivity"
+                android:label="@string/app_nav_home_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.LAUNCHER" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".app.SimpleUpActivity"
+                  android:label="@string/simple_up_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.AppNavHomeActivity" />
+        </activity>
+
+        <activity android:name=".app.PeerActivity"
+                  android:label="@string/peer_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.AppNavHomeActivity" />
+        </activity>
+
+        <activity android:name=".app.ViewFromOtherTaskActivity"
+                  android:label="@string/view_from_other_task_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.AppNavHomeActivity" />
+        </activity>
+
+        <activity android:name=".app.OutsideTaskActivity"
+                  android:label="@string/outside_task_label"
+                  android:theme="@style/Theme.Light"
+                  android:taskAffinity="com.example.android.appnavigation.outsidetask">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+        <activity android:name=".app.ContentViewActivity"
+                  android:label="@string/content_view_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <action android:name="android.intent.action.VIEW" />
+                <data android:mimeType="application/x-example" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.ContentCategoryActivity" />
+        </activity>
+
+        <activity android:name=".app.ContentCategoryActivity"
+                  android:label="@string/content_category_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.AppNavHomeActivity" />
+        </activity>
+
+        <activity android:name=".app.NotificationsActivity"
+                  android:label="@string/notifications_label">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.SAMPLE_CODE" />
+            </intent-filter>
+            <meta-data android:name="android.support.PARENT_ACTIVITY"
+                       android:value=".app.AppNavHomeActivity" />
+        </activity>
+
+        <activity android:name=".app.InterstitialMessageActivity"
+                  android:label="@string/interstitial_label"
+                  android:theme="@style/Theme.Dialog"
+                  android:launchMode="singleTask"
+                  android:excludeFromRecents="true"
+                  android:taskAffinity="">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+            </intent-filter>
+        </activity>
+    </application>
+</manifest>
diff --git a/samples/AppNavigation/res/layout/content_category.xml b/samples/AppNavigation/res/layout/content_category.xml
new file mode 100644
index 0000000..2727260
--- /dev/null
+++ b/samples/AppNavigation/res/layout/content_category.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/intermediate_description" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/launch_content_view"
+            android:onClick="onViewContent" />
+</LinearLayout>
diff --git a/samples/AppNavigation/res/layout/content_view.xml b/samples/AppNavigation/res/layout/content_view.xml
new file mode 100644
index 0000000..eabd2eb
--- /dev/null
+++ b/samples/AppNavigation/res/layout/content_view.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/content_view_description" />
+    <TextView android:id="@+id/status_text"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:layout_marginTop="8dp"
+              android:text="@string/default_status_text" />
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/AppNavigation/res/layout/interstitial_message.xml b/samples/AppNavigation/res/layout/interstitial_message.xml
new file mode 100644
index 0000000..d957ecd
--- /dev/null
+++ b/samples/AppNavigation/res/layout/interstitial_message.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:orientation="vertical"
+              style="@style/InterstitialDialogLayout">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/interstitial_description"
+              android:layout_marginTop="16dp"
+              android:layout_marginBottom="16dp"
+              android:layout_marginLeft="16dp"
+              android:layout_marginRight="16dp"/>
+    <LinearLayout android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  style="@style/ButtonBar">
+        <Button android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/launch_content_view"
+                android:onClick="onViewContent"
+                style="@style/ButtonBarButton"/>
+    </LinearLayout>
+</LinearLayout>
diff --git a/samples/AppNavigation/res/layout/notifications.xml b/samples/AppNavigation/res/layout/notifications.xml
new file mode 100644
index 0000000..10112f3
--- /dev/null
+++ b/samples/AppNavigation/res/layout/notifications.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/notifications_description" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/post_direct_notification"
+            android:onClick="onPostDirect" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/post_interstitial_notification"
+            android:onClick="onPostInterstitial" />
+</LinearLayout>
diff --git a/samples/AppNavigation/res/layout/outside_task.xml b/samples/AppNavigation/res/layout/outside_task.xml
new file mode 100644
index 0000000..00c78aa
--- /dev/null
+++ b/samples/AppNavigation/res/layout/outside_task.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/outside_task_description" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/launch_content_view"
+            android:onClick="onViewContent" />
+</LinearLayout>
diff --git a/samples/AppNavigation/res/layout/peer.xml b/samples/AppNavigation/res/layout/peer.xml
new file mode 100644
index 0000000..ee706b3
--- /dev/null
+++ b/samples/AppNavigation/res/layout/peer.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/peer_description" />
+    <TextView android:id="@+id/peer_counter"
+              android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:layout_marginTop="8dp"
+              android:text="@string/peer_count" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/launch_peer"
+            android:onClick="onLaunchPeer" />
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/AppNavigation/res/layout/simple_up.xml b/samples/AppNavigation/res/layout/simple_up.xml
new file mode 100644
index 0000000..2897d84
--- /dev/null
+++ b/samples/AppNavigation/res/layout/simple_up.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android"
+          android:layout_width="match_parent"
+          android:layout_height="match_parent"
+          android:text="@string/simple_up_description"
+          android:padding="16dp" />
diff --git a/samples/AppNavigation/res/layout/view_from_other_task.xml b/samples/AppNavigation/res/layout/view_from_other_task.xml
new file mode 100644
index 0000000..941d74c
--- /dev/null
+++ b/samples/AppNavigation/res/layout/view_from_other_task.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:padding="16dp"
+              android:orientation="vertical">
+    <TextView android:layout_width="match_parent"
+              android:layout_height="wrap_content"
+              android:text="@string/view_from_other_task_description" />
+    <Button android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:layout_marginTop="8dp"
+            android:text="@string/launch_other_task"
+            android:onClick="onLaunchOtherTask" />
+</LinearLayout>
\ No newline at end of file
diff --git a/samples/AppNavigation/res/values-v11/styles.xml b/samples/AppNavigation/res/values-v11/styles.xml
new file mode 100644
index 0000000..e61e9d4
--- /dev/null
+++ b/samples/AppNavigation/res/values-v11/styles.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="InterstitialDialogLayout">
+        <item name="android:divider">?android:attr/dividerHorizontal</item>
+        <item name="android:showDividers">middle</item>
+    </style>
+
+    <style name="ButtonBar" parent="@android:style/Holo.ButtonBar.AlertDialog" />
+    <style name="ButtonBarButton" parent="@android:style/Widget.Holo.Button.Borderless" />
+
+</resources>
diff --git a/samples/AppNavigation/res/values-v11/themes.xml b/samples/AppNavigation/res/values-v11/themes.xml
new file mode 100644
index 0000000..b9f7fdb
--- /dev/null
+++ b/samples/AppNavigation/res/values-v11/themes.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="Theme.Light" parent="@android:style/Theme.Holo.Light" />
+    <style name="Theme.Dialog" parent="@android:style/Theme.Holo.Dialog" />
+</resources>
diff --git a/samples/AppNavigation/res/values-v14/themes.xml b/samples/AppNavigation/res/values-v14/themes.xml
new file mode 100644
index 0000000..79fabda
--- /dev/null
+++ b/samples/AppNavigation/res/values-v14/themes.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="Theme.Light" parent="@android:style/Theme.DeviceDefault.Light" />
+</resources>
diff --git a/samples/AppNavigation/res/values/ids.xml b/samples/AppNavigation/res/values/ids.xml
new file mode 100644
index 0000000..c143cf7
--- /dev/null
+++ b/samples/AppNavigation/res/values/ids.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <item type="id" name="direct_notification" />
+    <item type="id" name="interstitial_notification" />
+</resources>
diff --git a/samples/AppNavigation/res/values/strings.xml b/samples/AppNavigation/res/values/strings.xml
new file mode 100644
index 0000000..66ac469
--- /dev/null
+++ b/samples/AppNavigation/res/values/strings.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <string name="app_name">App Navigation Sample</string>
+    <string name="app_nav_home_label">App Navigation</string>
+
+    <string name="simple_up_label">Simple Up Navigation</string>
+    <string name="simple_up_description">This demo shows the simple case of up navigation that does not ever need to cross across different tasks. Press the up button on the action bar to return to the demo list. For simple drill-down navigation, the application up and system back buttons will navigate to the same location, leaving the task\'s back stack in the same state.</string>
+
+    <string name="peer_label">Peer Activities</string>
+    <string name="peer_description">This is an activity that shows content with many navigation peers. Think of a content browser that offers links to related content items. Pressing back from this activity will return to the previously viewed content item if you reached this point through a related link. If you reached it from the app nav example home activity, back will return there. Navigating up from this activity will always return to the app nav example home activity and clean up the back stack along the way.</string>
+    <string name="launch_peer">Link to another peer activity</string>
+    <string name="peer_count">Peer count: </string>
+
+    <string name="view_from_other_task_label">View from other task</string>
+    <string name="view_from_other_task_description">This combined demo shows how to handle up navigation when another task has launched your app\'s activity on its own task stack. Navigating up in this scenario should synthesize a task stack representing the most common or direct navigation path to the parent activity. The code example shows how to handle this using helper code from the support library. Press the button below to launch a separate task and begin the demo.</string>
+    <string name="launch_other_task">Launch new task</string>
+
+    <string name="outside_task_label">Outside Task</string>
+    <string name="outside_task_description">This activity has been launched in a new task. You can confirm this by pressing the Recents button now and switching back to the app navigation example task. This activity will view content with the fake mimetype \"application/x-example\" which will be received by another code example activity to continue the demo. Press the View button below.</string>
+
+    <string name="content_view_label">Content Viewer</string>
+    <string name="content_view_description">This activity can receive ACTION_VIEW intents with the mimetype \"application/x-example\", sent by the outside task component of this demo. If you launched the activity this way then it will be on the viewing activity\'s task stack. Press the back button to finish this activity and return to the activity that wanted to view the content. Press the up button in the action bar to jump back into the main demo task with a synthesized back stack. This matches the pattern for content viewers such as a photo gallery or video player.</string>
+    <string name="default_status_text">Navigated here from category</string>
+
+    <string name="content_category_label">Content Category</string>
+    <string name="intermediate_description">This activity is a parent for the example content viewer activity. Navigating up from the content viewer will lead here. Navigating up from here will lead back to the app navigation home activity. Note that if you reached this activity by navigating up from the example content viewer activity, you are back on the main app navigation example task. Press the button below to navigate to the content viewer activity.</string>
+    <string name="launch_content_view">Launch content view activity</string>
+
+    <string name="notifications_label">Notifications</string>
+    <string name="notifications_description">There are two classes of notifications: notifications that deep-link into an app directly, (e.g. an incoming SMS) and notifications that present an interstitial/summary of multiple collapsed notifications before linking into the app itself. (e.g. Calendar event notifications.) The buttons below will create notifications of each type.</string>
+    <string name="post_direct_notification">Post direct notification</string>
+    <string name="post_interstitial_notification">Post interstitial notification</string>
+
+    <string name="interstitial_label">Interstitial</string>
+    <string name="interstitial_description">This is an interstitial activity running in response to a notification. It presents a summary of info in a lightweight manner that does not exist as a task in Recents. Tap the button below to jump to the primary content.</string>
+
+</resources>
diff --git a/samples/AppNavigation/res/values/styles.xml b/samples/AppNavigation/res/values/styles.xml
new file mode 100644
index 0000000..d869170
--- /dev/null
+++ b/samples/AppNavigation/res/values/styles.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="InterstitialDialogLayout" />
+
+    <style name="ButtonBar" parent="@android:style/ButtonBar" />
+    <style name="ButtonBarButton" parent="@android:style/Widget.Button" />
+
+</resources>
diff --git a/samples/AppNavigation/res/values/themes.xml b/samples/AppNavigation/res/values/themes.xml
new file mode 100644
index 0000000..beebacf
--- /dev/null
+++ b/samples/AppNavigation/res/values/themes.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+<resources>
+    <style name="Theme.Light" parent="@android:style/Theme.Light" />
+    <style name="Theme.Dialog" parent="@android:style/Theme.Dialog" />
+</resources>
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/ActionBarCompat.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/ActionBarCompat.java
new file mode 100644
index 0000000..0822336
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/ActionBarCompat.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import android.app.Activity;
+import android.os.Build;
+
+/**
+ * Very limited shim for enabling the action bar's up button on devices that support it.
+ */
+public class ActionBarCompat {
+    /**
+     * This class will only ever be loaded if the version check succeeds,
+     * keeping the verifier from rejecting the use of framework classes that
+     * don't exist on older platform versions.
+     */
+    static class ActionBarCompatImpl {
+        static void setDisplayHomeAsUpEnabled(Activity activity, boolean enable) {
+            activity.getActionBar().setDisplayHomeAsUpEnabled(enable);
+        }
+    }
+
+    public static void setDisplayHomeAsUpEnabled(Activity activity, boolean enable) {
+        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
+            ActionBarCompatImpl.setDisplayHomeAsUpEnabled(activity, enable);
+        }
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/AppNavHomeActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/AppNavHomeActivity.java
new file mode 100644
index 0000000..469ab4e
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/AppNavHomeActivity.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import android.app.ListActivity;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Bundle;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Home activity for app navigation code samples.
+ */
+public class AppNavHomeActivity extends ListActivity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setListAdapter(new SampleAdapter(querySampleActivities()));
+    }
+
+    @Override
+    protected void onListItemClick(ListView lv, View v, int pos, long id) {
+        SampleInfo info = (SampleInfo) getListAdapter().getItem(pos);
+        startActivity(info.intent);
+    }
+
+    protected List<SampleInfo> querySampleActivities() {
+        Intent intent = new Intent(Intent.ACTION_MAIN, null);
+        intent.setPackage(getPackageName());
+        intent.addCategory(Intent.CATEGORY_SAMPLE_CODE);
+
+        PackageManager pm = getPackageManager();
+        List<ResolveInfo> infos = pm.queryIntentActivities(intent, 0);
+
+        ArrayList<SampleInfo> samples = new ArrayList<SampleInfo>();
+
+        final int count = infos.size();
+        for (int i = 0; i < count; i++) {
+            final ResolveInfo info = infos.get(i);
+            final CharSequence labelSeq = info.loadLabel(pm);
+            String label = labelSeq != null ? labelSeq.toString() : info.activityInfo.name;
+
+            Intent target = new Intent();
+            target.setClassName(info.activityInfo.applicationInfo.packageName,
+                    info.activityInfo.name);
+            SampleInfo sample = new SampleInfo(label, target);
+            samples.add(sample);
+        }
+
+        return samples;
+    }
+
+    static class SampleInfo {
+        String name;
+        Intent intent;
+
+        SampleInfo(String name, Intent intent) {
+            this.name = name;
+            this.intent = intent;
+        }
+    }
+
+    class SampleAdapter extends BaseAdapter {
+        private List<SampleInfo> mItems;
+
+        public SampleAdapter(List<SampleInfo> items) {
+            mItems = items;
+        }
+
+        @Override
+        public int getCount() {
+            return mItems.size();
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return mItems.get(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            if (convertView == null) {
+                convertView = getLayoutInflater().inflate(android.R.layout.simple_list_item_1,
+                        parent, false);
+                convertView.setTag(convertView.findViewById(android.R.id.text1));
+            }
+            TextView tv = (TextView) convertView.getTag();
+            tv.setText(mItems.get(position).name);
+            return convertView;
+        }
+
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentCategoryActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentCategoryActivity.java
new file mode 100644
index 0000000..534f391
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentCategoryActivity.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.view.MenuItem;
+import android.view.View;
+
+public class ContentCategoryActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.content_category);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    public void onViewContent(View v) {
+        Intent target = new Intent(this, ContentViewActivity.class);
+        startActivity(target);
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentViewActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentViewActivity.java
new file mode 100644
index 0000000..5283230
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/ContentViewActivity.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.support.v4.app.ShareCompat;
+import android.support.v4.app.TaskStackBuilder;
+import android.text.TextUtils;
+import android.view.MenuItem;
+import android.widget.TextView;
+
+public class ContentViewActivity extends Activity {
+    public static final String EXTRA_TEXT = "com.example.android.appnavigation.EXTRA_TEXT";
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.content_view);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+
+        Intent intent = getIntent();
+        if (Intent.ACTION_VIEW.equals(intent.getAction())) {
+            TextView tv = (TextView) findViewById(R.id.status_text);
+            tv.setText("Viewing content from ACTION_VIEW");
+        } else if (intent.hasExtra(EXTRA_TEXT)) {
+            TextView tv = (TextView) findViewById(R.id.status_text);
+            tv.setText(intent.getStringExtra(EXTRA_TEXT));
+        }
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            Intent upIntent = NavUtils.getParentActivityIntent(this);
+            if (NavUtils.shouldUpRecreateTask(this, upIntent)) {
+                TaskStackBuilder.from(this)
+                        .addParentStack(this)
+                        .startActivities();
+                finish();
+            } else {
+                NavUtils.navigateUpTo(this, upIntent);
+            }
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/InterstitialMessageActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/InterstitialMessageActivity.java
new file mode 100644
index 0000000..1d0154d
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/InterstitialMessageActivity.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.TaskStackBuilder;
+import android.view.View;
+
+public class InterstitialMessageActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.interstitial_message);
+    }
+
+    public void onViewContent(View v) {
+        TaskStackBuilder.from(this)
+                .addParentStack(ContentViewActivity.class)
+                .addNextIntent(new Intent(this, ContentViewActivity.class)
+                        .putExtra(ContentViewActivity.EXTRA_TEXT, "From Interstitial Notification"))
+                .startActivities();
+        finish();
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/NotificationsActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/NotificationsActivity.java
new file mode 100644
index 0000000..f14dbc6
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/NotificationsActivity.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.app.NotificationManager;
+import android.app.PendingIntent;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.support.v4.app.NotificationCompat;
+import android.support.v4.app.TaskStackBuilder;
+import android.view.MenuItem;
+import android.view.View;
+
+public class NotificationsActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.notifications);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    public void onPostDirect(View v) {
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
+                .setTicker("Direct Notification")
+                .setSmallIcon(android.R.drawable.stat_notify_chat)
+                .setContentTitle("Direct Notification")
+                .setContentText("This will open the content viewer")
+                .setAutoCancel(true)
+                .setContentIntent(TaskStackBuilder.from(this)
+                        .addParentStack(ContentViewActivity.class)
+                        .addNextIntent(new Intent(this, ContentViewActivity.class)
+                                .putExtra(ContentViewActivity.EXTRA_TEXT, "From Notification"))
+                        .getPendingIntent(0, 0));
+        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+        nm.notify("direct_tag", R.id.direct_notification, builder.getNotification());
+    }
+
+    public void onPostInterstitial(View v) {
+        NotificationCompat.Builder builder = new NotificationCompat.Builder(this)
+                .setTicker("Interstitial Notification")
+                .setSmallIcon(android.R.drawable.stat_notify_chat)
+                .setContentTitle("Interstitial Notification")
+                .setContentText("This will show a detail page")
+                .setAutoCancel(true)
+                .setContentIntent(PendingIntent.getActivity(this, 0,
+                        new Intent(this, InterstitialMessageActivity.class)
+                                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+                                        Intent.FLAG_ACTIVITY_CLEAR_TASK), 0));
+        NotificationManager nm = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
+        nm.notify("interstitial_tag", R.id.interstitial_notification, builder.getNotification());
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/OutsideTaskActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/OutsideTaskActivity.java
new file mode 100644
index 0000000..4022fa6
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/OutsideTaskActivity.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.view.View;
+
+public class OutsideTaskActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.outside_task);
+    }
+
+    public void onViewContent(View v) {
+        Intent intent = new Intent(Intent.ACTION_VIEW)
+                .setType("application/x-example")
+                .addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
+        startActivity(intent);
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/PeerActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/PeerActivity.java
new file mode 100644
index 0000000..45083fd
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/PeerActivity.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.view.MenuItem;
+import android.view.View;
+import android.widget.TextView;
+
+public class PeerActivity extends Activity {
+    private static final String EXTRA_PEER_COUNT =
+            "com.example.android.appnavigation.EXTRA_PEER_COUNT";
+
+    private int mPeerCount;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.peer);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+
+        mPeerCount = getIntent().getIntExtra(EXTRA_PEER_COUNT, 0) + 1;
+        TextView tv = (TextView) findViewById(R.id.peer_counter);
+        tv.setText(getResources().getText(R.string.peer_count).toString() + mPeerCount);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+
+    public void onLaunchPeer(View v) {
+        Intent target = new Intent(this, PeerActivity.class);
+        target.putExtra(EXTRA_PEER_COUNT, mPeerCount);
+        startActivity(target);
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/SimpleUpActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/SimpleUpActivity.java
new file mode 100644
index 0000000..4141951
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/SimpleUpActivity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.ActionBar;
+import android.app.Activity;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.view.MenuItem;
+
+public class SimpleUpActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.simple_up);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return super.onOptionsItemSelected(item);
+    }
+}
diff --git a/samples/AppNavigation/src/com/example/android/appnavigation/app/ViewFromOtherTaskActivity.java b/samples/AppNavigation/src/com/example/android/appnavigation/app/ViewFromOtherTaskActivity.java
new file mode 100644
index 0000000..06e1699
--- /dev/null
+++ b/samples/AppNavigation/src/com/example/android/appnavigation/app/ViewFromOtherTaskActivity.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.example.android.appnavigation.app;
+
+import com.example.android.appnavigation.R;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.support.v4.app.NavUtils;
+import android.view.MenuItem;
+import android.view.View;
+
+public class ViewFromOtherTaskActivity extends Activity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.view_from_other_task);
+
+        ActionBarCompat.setDisplayHomeAsUpEnabled(this, true);
+    }
+
+    @Override
+    public boolean onOptionsItemSelected(MenuItem item) {
+        if (item.getItemId() == android.R.id.home) {
+            NavUtils.navigateUpFromSameTask(this);
+            return true;
+        }
+        return false;
+    }
+
+    public void onLaunchOtherTask(View v) {
+        Intent target = new Intent(this, OutsideTaskActivity.class)
+                .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |
+                        Intent.FLAG_ACTIVITY_TASK_ON_HOME);
+        startActivity(target);
+    }
+}