App Navigation Sample
App Navigation
Simple Up Navigation
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.
Peer Activities
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.
Link to another peer activity
Peer count:
View from other task
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.
Launch new task
Outside Task
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.
Content Viewer
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.
Navigated here from category
Content Category
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.
Launch content view activity
Notifications
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.
Post direct notification
Post interstitial notification
Interstitial
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.