diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd index 3f4aaa95a8ab9..8e07a08f55534 100644 --- a/docs/html/guide/practices/tablets-and-handsets.jd +++ b/docs/html/guide/practices/tablets-and-handsets.jd @@ -99,7 +99,8 @@ side.
You can enable items from the options menu to appear directly in the action bar as "action items". You can also add navigation features to the action bar, such as tabs or a drop-down list, -and use the application icon to supplement the system's BACK behavior with the option to navigate to +and use the application icon to supplement the system's Back button behavior with the option to +navigate to your application's "home" activity or "up" the application's structural hierarchy.
This guide provides some tips for using the action bar in ways that support both tablets and @@ -458,7 +459,8 @@ attribute.
developer guide, you can use the application icon in the action bar to facilitate user navigation when appropriate—either as a method to get back to the "home" activity (similar to clicking the logo on a web site) or as a way to navigate up the application's structural hierarchy. Although -it might seem similar to the standard BACK navigation in some cases, the up navigation option +it might seem similar to the standard Back navigation in some cases, the up navigation +option provides a more predictable navigation method for situations in which the user may have entered from an external location, such as a notification, app widget, or a different application. diff --git a/docs/html/guide/practices/ui_guidelines/activity_task_design.jd b/docs/html/guide/practices/ui_guidelines/activity_task_design.jd index 5faa7ece8502e..9be72eea99352 100644 --- a/docs/html/guide/practices/ui_guidelines/activity_task_design.jd +++ b/docs/html/guide/practices/ui_guidelines/activity_task_design.jd @@ -42,7 +42,8 @@ parent.link=index.html
The following examples illustrate basic principles for applications,
- activities, the activity stack, the BACK key, tasks and intents. It
+ activities, the activity stack, the Back button, tasks and intents. It
shows how the system responds to user actions such as starting
activities and switching between tasks. With most of these examples
you can follow along, launching activities on your device as
@@ -367,19 +369,20 @@ itself.
An activity can keep or lose its state depending on how the user - leaves the activity — by the HOME or BACK key. + leaves the activity — by the Home or Back button.
- By default, pressing the BACK key finishes (destroys) the current + By default, pressing the Back button finishes (destroys) the current activity and displays the previous activity to the user. In the following figure, the user starts email by touching the Email icon in the Home screen, which displays a list of email messages. The user - scrolls down the list (changing its initial state). Pressing BACK + scrolls down the list (changing its initial state). Pressing Back destroys the List Messages activity and returns to the previous activity, which is Home. If the user re-launches Email, it would re-load the messages and display its initial, non-scrolled state. @@ -390,15 +393,15 @@ itself.
- In the above example, pressing BACK goes to Home because it was the + In the above example, pressing Back goes to Home because it was the last activity the user was viewing. But if the user had gotten to List - Message from some other activity, then pressing BACK would have + Message from some other activity, then pressing Back would have returned there.
By contrast, the next figure shows the user leaving List Messages by - pressing HOME instead of BACK — the List Messages activity is + pressing Home instead of Back — the List Messages activity is stopped and moved to the background rather than being destroyed. Starting Email again from its icon would simply bring the List Messages activity to the foreground (changing it from stopped to @@ -423,8 +426,8 @@ itself.
In addition, not all activities have the behavior that they are - destroyed when BACK is pressed. When the user starts playing music in - the Music application and then presses BACK, the application overrides + destroyed when Back is pressed. When the user starts playing music in + the Music application and then presses Back, the application overrides the normal back behavior, preventing the player activity from being destroyed, and continues playing music, even though its activity is no longer visible — as a visual substitute, the Music application @@ -451,7 +454,7 @@ itself. activity to get a picture. This is a good example of re-use of the Gallery activity. The following figure illustrates the sequence of activities to do this (up to crop). This is how it's done: The user - chooses Contacts, selects the contact for viewing, chooses MENU > + chooses Contacts, selects the contact for viewing, chooses Menu > Edit contact and touches the picture field, which launches the Gallery activity. The user then chooses the picture they want, crops and saves it. Saving it causes the picture to be inserted into the picture field @@ -484,12 +487,12 @@ itself. Gallery Re-Uses Messaging for Sharing a Picture - Sharing is another good example of one application re-using an activity from a different application. As shown in the following figure, the user - starts Gallery, picks a picture to view, chooses MENU > Share, and + starts Gallery, picks a picture to view, chooses Menu > Share, and picks "Messaging". This starts the Messaging activity, creates a new message and attaches the original picture to it. The user then fills in the "To" field, writes a short message and sends it. User focus remains in the Messaging program. If the user wants to go back to the - Gallery, they must press the BACK key. (The user can back up through + Gallery, they must press the Back button. (The user can back up through each activity all the way to Home.)
@@ -552,7 +555,7 @@ itself.- Home > Messaging > New message > MENU > Attach + Home > Messaging > New message > Menu > Attach > Pictures. This last step launches the picture gallery for picking a photo. Notice that picture gallery is an activity in a separate application. @@ -961,7 +964,7 @@ MAIN and address in an email message (or web page), where the Maps activity is started to map the location. No result from maps is expected to be returned to the email message; the user - can return by pressing the BACK key. (Such an activity is + can return by pressing the Back button. (Such an activity is started with {@link android.content.Context#startActivity(android.content.Intent) startActivity()}.) @@ -1102,20 +1105,21 @@ MAIN and convenience to respond to your message.
-As a user navigates from one activity to the next, the system adds them to the activity stack. This forms a navigation history that is - accessible with the BACK key. Most activities are relatively limited + accessible with the Back button. Most activities are relatively limited in scope, with just one set of data, such as viewing a list of contacts, composing an email, or taking a photo. But what if your application is one big activity with several pages of content and - needs finer-grained control of the BACK key? Examples of such Google + needs finer-grained control of the Back button? Examples of such Google applications are the Browser, which can have several web pages open at once, and Maps, which can have several layers of geographic data to switch between. Both of these applications take control of the - BACK key and maintain their own internal back stacks that operate + Back button and maintain their own internal back stacks that operate only when these applications have focus.
@@ -1124,7 +1128,7 @@ MAIN and information on a map to the user: displaying the location of a search result, displaying locations of friends, and displaying a line for a street path providing direction between points. Maps - stores these layers in its own history so the BACK key can return to + stores these layers in its own history so the Back button can return to a previous layer. @@ -1135,8 +1139,8 @@ MAIN and as Windows, Macintosh or Linux). For example, if you did a Google web search in one window of the Android Browser, clicking on a link in the search results displays a web page in that same window, and - then pressing BACK would to the search results page. Pressing - BACK goes to a previous window only if the current window was + then pressing Back would to the search results page. Pressing + Back goes to a previous window only if the current window was launched from that previous window. If the user keeps pressing back, they will eventually leave the browser activity and return Home. diff --git a/docs/html/guide/practices/ui_guidelines/menu_design.jd b/docs/html/guide/practices/ui_guidelines/menu_design.jd index 3edf33fe37597..7576b6c588588 100644 --- a/docs/html/guide/practices/ui_guidelines/menu_design.jd +++ b/docs/html/guide/practices/ui_guidelines/menu_design.jd @@ -71,7 +71,7 @@ parent.link=index.html- On most devices, a user presses the MENU button to access the Options menu, + On most devices, a user presses the Menu button to access the Options menu, as shown in the screenshot below. To close the menu, the user presses - MENU again, or presses the BACK button. - In fact, to cancel out of any menu, press the BACK button. (Pressing the MENU + Menu again, or presses the Back button. + In fact, to cancel out of any menu, press the Back button. (Pressing the Menu button or touching outside the menu also works.) Note that how to invoke this menu may be different on different devices.
@@ -140,7 +140,7 @@ or device to another.On some versions of Android, the user can display keyboard shortcuts in the - icon menu by long pressing the MENU button — the text in the icon menu + icon menu by long pressing the Menu button — the text in the icon menu alternates between the command names and their keyboard shortcuts (if any).
@@ -299,7 +299,7 @@ or device to another. location) on the screen, put the command in the Context menu for that content. If the command acts on no specific content or location, put it in the Options menu. This separation of commands - is enforced by the system in the following way. When you press the MENU + is enforced by the system in the following way. When you press the Menu button to display the Options menu, the selected content becomes unselected, and so cannot be operated on. For an explanation of why the content becomes unselected, see the article on @@ -340,7 +340,7 @@ or device to another.Before opening a Context menu, it has no visual representation that identifies - its presence (whereas the Options menu has the MENU button), and so is not + its presence (whereas the Options menu has the Menu button), and so is not particularly discoverable. Therefore, in general, a Context menu should duplicate commands found in the corresponding activity screen. For example, while it's useful to @@ -459,7 +459,8 @@ or device to another.
- When a dialog is displayed, pressing the MENU button should do nothing. This also holds true + When a dialog is displayed, pressing the Menu button should do nothing. This also holds +true for activities that look like dialogs. A dialog box is recognizable by being smaller than full-screen, having zero to three buttons, is non-scrollable, and possibly a list of selectable items that can include checkboxes or radio buttons. @@ -475,7 +476,7 @@ or device to another.
- When the user presses the MENU button, if there is no Options menu, the system + When the user presses the Menu button, if there is no Options menu, the system currently does nothing. We recommend you do not perform any action (such as displaying a message). It's a better user experience for this behavior to be consistent across applications. diff --git a/docs/html/guide/topics/fundamentals/activities.jd b/docs/html/guide/topics/fundamentals/activities.jd index 3b311997e4b5d..8736aa89ed4ce 100644 --- a/docs/html/guide/topics/fundamentals/activities.jd +++ b/docs/html/guide/topics/fundamentals/activities.jd @@ -63,7 +63,7 @@ activity can then start another activity in order to perform different actions. activity starts, the previous activity is stopped, but the system preserves the activity in a stack (the "back stack"). When a new activity starts, it is pushed onto the back stack and takes user focus. The back stack abides to the basic "last in, first out" queue mechanism, -so, when the user is done with the current activity and presses the BACK key, it +so, when the user is done with the current activity and presses the Back button, it is popped from the stack (and destroyed) and the previous activity resumes. (The back stack is discussed more in the Tasks and Back Stack document.)
@@ -649,7 +649,8 @@ remains intact.Note: There's no guarantee that {@link android.app.Activity#onSaveInstanceState onSaveInstanceState()} will be called before your activity is destroyed, because there are cases in which it won't be necessary to save the state -(such as when the user leaves your activity using the BACK key, because the user is explicitly +(such as when the user leaves your activity using the Back button, because the user is +explicitly closing the activity). If the system calls {@link android.app.Activity#onSaveInstanceState onSaveInstanceState()}, it does so before {@link android.app.Activity#onStop onStop()} and possibly before {@link android.app.Activity#onPause diff --git a/docs/html/guide/topics/fundamentals/fragments.jd b/docs/html/guide/topics/fundamentals/fragments.jd index e8f6cd888ef84..d4f9342dd632f 100644 --- a/docs/html/guide/topics/fundamentals/fragments.jd +++ b/docs/html/guide/topics/fundamentals/fragments.jd @@ -78,7 +78,7 @@ manipulate each fragment independently, such as add or remove them. When you per fragment transaction, you can also add it to a back stack that's managed by the activity—each back stack entry in the activity is a record of the fragment transaction that occurred. The back stack allows the user to reverse a fragment transaction (navigate backwards), -by pressing the BACK button.
+by pressing the Back button.When you add a fragment as a part of your activity layout, it lives in a {@link android.view.ViewGroup} inside the activity's view hierarchy and the fragment defines its own view @@ -398,7 +398,7 @@ android.app.FragmentManager#findFragmentById findFragmentById()} (for fragments the activity layout) or {@link android.app.FragmentManager#findFragmentByTag findFragmentByTag()} (for fragments that do or don't provide a UI).
For example, here's how you can replace one fragment with another, and preserve the previous state in the back stack:
@@ -462,14 +462,14 @@ transaction.commit(); layout container identified by the {@code R.id.fragment_container} ID. By calling {@link android.app.FragmentTransaction#addToBackStack addToBackStack()}, the replace transaction is saved to the back stack so the user can reverse the transaction and bring back the -previous fragment by pressing the BACK key. +previous fragment by pressing the Back button.If you add multiple changes to the transaction (such as another {@link android.app.FragmentTransaction#add add()} or {@link android.app.FragmentTransaction#remove remove()}) and call {@link android.app.FragmentTransaction#addToBackStack addToBackStack()}, then all changes applied before you call {@link android.app.FragmentTransaction#commit commit()} are added to the -back stack as a single transaction and the BACK key will reverse them all together.
+back stack as a single transaction and the Back button will reverse them all together.The order in which you add changes to a {@link android.app.FragmentTransaction} doesn't matter, except:
@@ -696,7 +696,7 @@ document.The most significant difference in lifecycle between an activity and a fragment is how one is stored in its respective back stack. An activity is placed into a back stack of activities that's managed by the system when it's stopped, by default (so that the user can navigate back -to it with the BACK key, as discussed in Back button, as discussed in Tasks and Back Stack). However, a fragment is placed into a back stack managed by the host activity only when you explicitly request that the instance be saved by calling {@link diff --git a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd index 086ba71d717fc..465cf542dfb10 100644 --- a/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd +++ b/docs/html/guide/topics/fundamentals/tasks-and-back-stack.jd @@ -74,7 +74,7 @@ order in which each activity is opened.
suppose you have a two-pane layout using fragments, one of which is a list view (fragment A) and the other being a layout to display an item from the list (fragment B). When the user selects an item from the list, fragment B is replaced by a new fragment (fragment C). In this case, it might be -desireable for the user to navigate back to reveal fragment B, using the BACK button. +desireable for the user to navigate back to reveal fragment B, using the Back button.In order to add fragment B to the back stack so that this is possible, you must call {@link android.app.FragmentTransaction#addToBackStack addToBackStack()} before you {@link android.app.FragmentTransaction#commit()} the transaction that replaces fragment B with fragment @@ -94,22 +94,26 @@ is created and the "main" activity for that application opens as the root activi
When the current activity starts another, the new activity is pushed on the top of the stack and takes focus. The previous activity remains in the stack, but is stopped. When an activity -stops, the system retains the current state of its user interface. When the user presses the BACK +stops, the system retains the current state of its user interface. When the user presses the +Back button, the current activity is popped from the top of the stack (the activity is destroyed) and the previous activity resumes (the previous state of its UI is restored). Activities in the stack are never rearranged, only pushed and popped from the stack—pushed onto the stack when started by -the current activity and popped off when the user leaves it using the BACK button. As such, the back +the current activity and popped off when the user leaves it using the Back button. As such, +the back stack operates as a "last in, first out" object structure. Figure 1 visualizes this behavior with a timeline showing the progress between activities along with the current back stack at each point in time.
Figure 1. A representation of how each new activity in a -task adds an item to the back stack. When the user presses the BACK button, the current activity is +task adds an item to the back stack. When the user presses the Back button, the current +activity is destroyed and the previous activity resumes.
-If the user continues to press BACK, then each activity in the stack is popped off to reveal the +
If the user continues to press Back, then each activity in the stack is popped off to +reveal the previous one, until the user returns to the Home screen (or to whichever activity was running when the task began). When all activities are removed from the stack, the task no longer exists.
@@ -124,11 +128,13 @@ class="img-caption">Figure 3. A single activity is instantiatedA task is a cohesive unit that can move to the "background" when users begin a new task or go -to the Home screen, via the HOME button. While in the background, all the activities in the task are +to the Home screen, via the Home button. While in the background, all the activities in the +task are stopped, but the back stack for the task remains intact—the task has simply lost focus while another task takes place, as shown in figure 2. A task can then return to the "foreground" so users can pick up where they left off. Suppose, for example, that the current task (Task A) has three -activities in its stack—two under the current activity. The user presses the HOME button, then +activities in its stack—two under the current activity. The user presses the Home +button, then starts a new application from the application launcher. When the Home screen appears, Task A goes into the background. When the new application starts, the system starts a task for that application (Task B) with its own stack of activities. After interacting with @@ -137,7 +143,8 @@ started Task A. Now, Task A comes to the foreground—all three activities in its stack are intact and the activity at the top of the stack resumes. At this point, the user can also switch back to Task B by going Home and selecting the application icon -that started that task (or by touching and holding the HOME button to reveal recent tasks and selecting +that started that task (or by touching and holding the Home button to reveal recent tasks +and selecting one). This is an example of multitasking on Android.
Note: Multiple tasks can be held in the background at once. @@ -150,7 +157,8 @@ users to start a particular activity from more than one activity, a new instance that activity is created and popped onto the stack (rather than bringing any previous instance of the activity to the top). As such, one activity in your application might be instantiated multiple times (even from different tasks), as shown in figure 3. As such, if the user navigates backward -using the BACK button, each instance of the activity is revealed in the order they were opened (each +using the Back button, each instance of the activity is revealed in the order they were +opened (each with their own UI state). However, you can modify this behavior if you do not want an activity to be instantiated more than once. How to do so is discussed in the later section about Managing Tasks.
@@ -161,13 +169,15 @@ href="#ManagingTasks">Managing Tasks.Caution: Most applications should not interrupt the default behavior for activities and tasks. If you determine that it's necessary for your activity to modify the default behaviors, use caution and be sure to test the usability of the activity during -launch and when navigating back to it from other activities and tasks with the BACK button. Be sure +launch and when navigating back to it from other activities and tasks with the Back button. +Be sure to test for navigation behaviors that might conflict with the user's expected behavior.
@@ -320,8 +331,10 @@ android.app.Activity#onNewIntent onNewIntent()}, because it's at the top of the stack remains A-B-C-D. However, if an intent arrives for an activity of type B, then a new instance of B is added to the stack, even if its launch mode is {@code "singleTop"}.Note: When a new instance of an activity is created, -the user can press the BACK button to return to the previous activity. But when an existing instance of -an activity handles a new intent, the user cannot press the BACK button to return to the state of +the user can press the Back button to return to the previous activity. But when an existing +instance of +an activity handles a new intent, the user cannot press the Back button to return to the +state of the activity before the new intent arrived in {@link android.app.Activity#onNewIntent onNewIntent()}.
@@ -333,7 +346,7 @@ intent to the existing instance through a call to its {@link android.app.Activity#onNewIntent onNewIntent()} method, rather than creating a new instance. Only one instance of the activity can exist at a time.Note: Although the activity starts in a new task, the -BACK button still returns the user to the previous activity.
+Back button still returns the user to the previous activity.Regardless of whether an activity starts in a new task or in the same task as the activity that -started it, the BACK button always takes the user to the previous activity. However, if you +started it, the Back button always takes the user to the previous activity. However, if you start an activity that specifies the {@code singleTask} launch mode, then if an instance of that activity exists in a background task, that whole task is brought to the foreground. At this point, the back stack now includes all activities from the task brought forward, at the top of the @@ -454,7 +467,8 @@ flag, the system looks for a different task to house the new activity. Often, it However, it doesn't have to be. If there's already an existing task with the same affinity as the new activity, the activity is launched into that task. If not, it begins a new task.
-If this flag causes an activity to begin a new task and the user presses the HOME button to leave +
If this flag causes an activity to begin a new task and the user presses the Home button +to leave it, there must be some way for the user to navigate back to the task. Some entities (such as the notification manager) always start activities in an external task, never as part of their own, so they always put {@code FLAG_ACTIVITY_NEW_TASK} in the intents they pass to {@link @@ -556,7 +570,8 @@ android.content.Intent#ACTION_MAIN} and a {@link android.content.Intent#CATEGORY_LAUNCHER} filter. Imagine, for example, what could happen if the filter is missing: An intent launches a {@code "singleTask"} activity, initiating a new task, and the user spends some time working in -that task. The user then presses the HOME button. The task is now sent to the background and is +that task. The user then presses the Home button. The task is now sent to the background +and is not visible. Now the user has no way to return to the task, because it is not represented in the application launcher.
diff --git a/docs/html/guide/topics/intents/intents-filters.jd b/docs/html/guide/topics/intents/intents-filters.jd index 3f9455391a86e..3ad3c9374a819 100644 --- a/docs/html/guide/topics/intents/intents-filters.jd +++ b/docs/html/guide/topics/intents/intents-filters.jd @@ -247,7 +247,7 @@ several category constants, including these:
-When the value is "{@code true}", every time users start the task again, they
-are brought to its root activity, regardless of what they were last doing in
-the task and regardless of whether they used BACK or HOME to last leave it.
-When the value is "{@code false}", the task may be cleared of activities in
+When the value is "{@code true}", every time users start the task again, they
+are brought to its root activity regardless of what they were last doing in
+the task and regardless of whether they used the Back or Home button to
+leave it. When the value is "{@code false}", the task may be cleared of activities in
some situations (see the
alwaysRetainTaskState attribute), but not always.
Suppose, for example, that someone launches activity P from the home screen, -and from there goes to activity Q. The user next presses HOME, and then returns +and from there goes to activity Q. The user next presses Home, and then returns to activity P. Normally, the user would see activity Q, since that is what they were last doing in P's task. However, if P set this flag to "{@code true}", all of the activities on top of it (Q in this case) were removed when the user pressed -HOME and the task went to the background. So the user sees only P when returning +Home and the task went to the background. So the user sees only P when returning to the task.
@@ -501,7 +501,7 @@ users and is very different from most other applications.Regardless of the launch mode that you choose, make sure to test the usability of the activity during launch and when navigating back to it from -other activities and tasks using the BACK key.
+other activities and tasks using the Back button.For more information on launch modes and their interaction with Intent flags, see the diff --git a/docs/html/guide/topics/search/search-dialog.jd b/docs/html/guide/topics/search/search-dialog.jd index e06563d47d2bb..8b8e75bb8a738 100644 --- a/docs/html/guide/topics/search/search-dialog.jd +++ b/docs/html/guide/topics/search/search-dialog.jd @@ -544,7 +544,8 @@ public boolean onSearchRequested() { } -
If the user cancels search by pressing the BACK button, the search dialog closes and the activity +
If the user cancels search by pressing the Back button, the search dialog closes and the +activity regains input focus. You can register to be notified when the search dialog is closed with {@link android.app.SearchManager#setOnDismissListener(SearchManager.OnDismissListener) setOnDismissListener()} @@ -569,7 +570,8 @@ things happens:
android.content.Intent#ACTION_SEARCH} intent with a call to {@link android.app.Activity#onCreate(Bundle) onCreate()} and a new instance of the activity is brought to the top of the activity stack. There are now two instances of your -searchable activity in the activity stack (so pressing the BACK button goes back to the previous +searchable activity in the activity stack (so pressing the Back button goes back to the +previous instance of the searchable activity, rather than exiting the searchable activity)."singleTop", then the
searchable activity receives the {@link android.content.Intent#ACTION_SEARCH} intent with a call
diff --git a/docs/html/guide/topics/ui/index.jd b/docs/html/guide/topics/ui/index.jd
index d3060c587eeac..83c8150003679 100644
--- a/docs/html/guide/topics/ui/index.jd
+++ b/docs/html/guide/topics/ui/index.jd
@@ -174,7 +174,8 @@ href="ui-events.html">Input Events document.
Application menus are another important part of an application's UI. Menus offers a reliable interface that reveals application functions and settings. The most common application menu is revealed by pressing -the MENU key on the device. However, you can also add Context Menus, which may be revealed when the user presses +the Menu button on the device. However, you can also add Context Menus, which may be +revealed when the user presses and holds down on an item.
Menus are also structured using a View hierarchy, but you don't define this structure yourself. Instead, diff --git a/docs/html/guide/topics/ui/notifiers/notifications.jd b/docs/html/guide/topics/ui/notifiers/notifications.jd index bef9671100bf0..d104b4bccd142 100644 --- a/docs/html/guide/topics/ui/notifiers/notifications.jd +++ b/docs/html/guide/topics/ui/notifiers/notifications.jd @@ -173,7 +173,7 @@ in these two typical notification flows, first handling a Calendar notification:
makeMessageIntentStack() method, which constructs
an array of intents representing the app's new activity stack for this state.
(If you are using fragments, you may need to initialize your fragment and
-app state so that pressing BACK will switch the UI back to its parent state.)
+app state so that pressing Back will switch the UI back to its parent state.)
The core of this is the {@link android.content.Intent#makeRestartActivityTask
Intent.makeRestartActivityTask()} method, which constructs the root activity
of the stack with the appropriate flags, such as
diff --git a/docs/html/guide/webapps/webview.jd b/docs/html/guide/webapps/webview.jd
index ed28f2117281e..66b5501688204 100644
--- a/docs/html/guide/webapps/webview.jd
+++ b/docs/html/guide/webapps/webview.jd
@@ -298,18 +298,18 @@ history of visited web
pages. You can navigate backward and forward through the history with {@link
android.webkit.WebView#goBack()} and {@link android.webkit.WebView#goForward()}.
-For example, here's how your {@link android.app.Activity} can use the device BACK key to navigate -backward:
+For example, here's how your {@link android.app.Activity} can use the device Back button +to navigate backward:
@Override
public boolean {@link android.app.Activity#onKeyDown(int,KeyEvent) onKeyDown}(int keyCode, KeyEvent event) {
- // Check if the key event was the BACK key and if there's history
+ // Check if the key event was the Back button and if there's history
if ((keyCode == KeyEvent.KEYCODE_BACK) && myWebView.{@link android.webkit.WebView#canGoBack() canGoBack}() {
myWebView.{@link android.webkit.WebView#goBack() goBack}();
return true;
}
- // If it wasn't the BACK key or there's no web page history, bubble up to the default
+ // If it wasn't the Back key or there's no web page history, bubble up to the default
// system behavior (probably exit the activity)
return super.onKeyDown(keyCode, event);
}
diff --git a/docs/html/training/design-navigation/ancestral-temporal.jd b/docs/html/training/design-navigation/ancestral-temporal.jd
index c0b1aef738e92..ab6a64d2925ab 100644
--- a/docs/html/training/design-navigation/ancestral-temporal.jd
+++ b/docs/html/training/design-navigation/ancestral-temporal.jd
@@ -29,7 +29,10 @@ next.link=wireframing.html
-Now that users can navigate deep into the application's screen hierarchy, we need to provide a method for navigating up the hierarchy, to parent and ancestor screens. Additionally, we should ensure that temporal navigation via the BACK button is respected to respect Android conventions.
+Now that users can navigate deep into the application's
+screen hierarchy, we need to provide a method for navigating up the hierarchy, to parent and
+ancestor screens. Additionally, we should ensure that temporal navigation via the Back
+button is respected to respect Android conventions.
Back/Up Navigation Design
@@ -39,27 +42,52 @@ next.link=wireframing.html
Support Temporal Navigation: Back
-Temporal navigation, or navigation between historical screens, is deeply rooted in the Android system. All Android users expect the BACK button to take them to the previous screen, regardless of other state. The set of historical screens is always rooted at the user's Launcher application (the phone's "home" screen). That is, pressing BACK enough times should land you back at the Launcher, after which the BACK button will do nothing.
+Temporal navigation, or navigation between historical screens, is deeply rooted in the Android
+system. All Android users expect the Back button to take them to the previous screen,
+regardless of other state. The set of historical screens is always rooted at the user's Launcher
+application (the phone's "home" screen). That is, pressing Back enough times should land
+you back at the Launcher, after which the Back button will do nothing.
+ alt="The Back button behavior after entering the Email app from the People (or Contacts) app"
+id="figure-navigate-back">
-Figure 1. The BACK button behavior after entering the Email app from the People (or Contacts) app.
+Figure 1. The Back button behavior after entering
+the Email app from the People (or Contacts) app.
-Applications generally don't have to worry about managing the BACK button themselves; the system handles tasks and the back stack, or the list of previous screens, automatically. The BACK button by default simply traverses this list of screens, removing the current screen from the list upon being pressed.
+Applications generally don't have to worry about managing the Back button themselves;
+the system handles tasks and
+the back stack, or the list of previous screens, automatically. The Back
+button by default simply traverses this list of screens, removing the current screen from the list
+upon being pressed.
-There are, however, cases where you may want to override the behavior for BACK. For example, if your screen contains an embedded web browser where users can interact with page elements to navigate between web pages, you may wish to trigger the embedded browser's default back behavior when users press the device's BACK button. Upon reaching the beginning of the browser's internal history, you should always defer to the system's default behavior for the BACK button.
+There are, however, cases where you may want to override the behavior for Back. For
+example, if your screen contains an embedded web browser where users can interact with page elements
+to navigate between web pages, you may wish to trigger the embedded browser's default back
+behavior when users press the device's Back button. Upon reaching the beginning of the
+browser's internal history, you should always defer to the system's default behavior for the
+Back button.
Provide Ancestral Navigation: Up and Home
-Before Android 3.0, the most common form of ancestral navigation was the Home metaphor. This was generally implemented as a Home item accessible via the device's MENU button, or a Home button at the top-left of the screen, usually as a component of the Action Bar (pattern docs at Android Design). Upon selecting Home, the user would be taken to the screen at the top of the screen hierarchy, generally known as the application's home screen.
+Before Android 3.0, the most common form of ancestral navigation was the Home metaphor.
+This was generally implemented as a Home item accessible via the device's Menu
+button, or a Home button at the top-left of the screen, usually as a component of the
+Action Bar (pattern docs at Android Design).
+Upon selecting Home, the user would be taken to the screen at the top of the screen
+hierarchy, generally known as the application's home screen.
Providing direct access to the application's home screen can give the user a sense of comfort and security. Regardless of where they are in the application, if they get lost in the app, they can select Home to arrive back at the familiar home screen.
-Android 3.0 introduced the Up metaphor, which is presented in the Action Bar as a substitute for the Home button described above. Upon tapping Up, the user should be taken to the parent screen in the hierarchy. This navigation step is usually the previous screen (as described with the BACK button discussion above), but this is not universally the case. Thus, developers must ensure that Up for each screen navigates to a single, predetermined parent screen.
+Android 3.0 introduced the Up metaphor, which is presented in the Action Bar as a
+substitute for the Home button described above. Upon tapping Up, the user should
+be taken to the parent screen in the hierarchy. This navigation step is usually the previous screen
+(as described with the Back button discussion above), but this is not universally the case.
+Thus, developers must ensure that Up for each screen navigates to a single, predetermined
+parent screen.
In some cases, it's appropriate for Up to perform an action rather than navigating to a parent screen. Take for example, the Gmail application for Android 3.0-based tablets. When viewing a mail conversation while holding the device in landscape, the conversation list, as well as the conversation details are presented side-by-side. This is a form of parent-child screen grouping, as discussed in a previous lesson. However, when viewing a mail conversation in the portrait orientation, only the conversation details are shown. The Up button is used to temporarily show the parent pane, which slides in from the left of the screen. Pressing the Up button again while the left pane is visible exits the context of the individual conversation, up to a full-screen list of conversations.
-Implementation Note: As a best practice, when implementing either Home or Up, make sure to clear the back stack of any descendent screens. For Home, the only remaining screen on the back stack should be the home screen. For Up navigation, the current screen should be removed from the back stack, unless BACK navigates across screen hierarchies. You can use the {@link android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP} and {@link android.content.Intent#FLAG_ACTIVITY_NEW_TASK} intent flags together to achieve this.
+Implementation Note: As a best practice, when implementing either
+Home or Up, make sure to clear the back stack of any descendent screens. For
+Home, the only remaining screen on the back stack should be the home screen. For
+Up navigation, the current screen should be removed from the back stack, unless
+Back navigates across screen hierarchies. You can use the {@link
+android.content.Intent#FLAG_ACTIVITY_CLEAR_TOP} and {@link
+android.content.Intent#FLAG_ACTIVITY_NEW_TASK} intent flags together to achieve this.
In the last lesson, we apply the concepts discussed in all of the lessons so far to create interaction design wireframes for our example news application.
diff --git a/docs/html/training/design-navigation/descendant-lateral.jd b/docs/html/training/design-navigation/descendant-lateral.jd
index 0064bd495c2d5..2d97e401d3a57 100644
--- a/docs/html/training/design-navigation/descendant-lateral.jd
+++ b/docs/html/training/design-navigation/descendant-lateral.jd
@@ -117,7 +117,16 @@ next.link=ancestral-temporal.html
Figure 5. Example phone and tablet tab-based navigation interfaces with relevant screen map excerpt.
-Several best practices apply when using tabs. Tabs should be persistent across immediate related screens. Only the designated content region should change when selecting a tab, and tab indicators should remain available at all times. Additionally, tab switches should not be treated as history. For example, if a user switches from a tab A to another tab B, pressing the BACK button (more on that in the next lesson) should not re-select tab A. Tabs are usually laid out horizontally, although other presentations of tab navigation such as using a drop-down list in the Action Bar (pattern docs at Android Design) are sometimes appropriate. Lastly, and most importantly, tabs should always run along the top of the screen, and should not be aligned to the bottom of the screen.
+Several best practices apply when using tabs. Tabs should be persistent across immediate related
+screens. Only the designated content region should change when selecting a tab, and tab indicators
+should remain available at all times. Additionally, tab switches should not be treated as history.
+For example, if a user switches from a tab A to another tab B, pressing the
+Back button (more on that in the next lesson) should
+not re-select tab A. Tabs are usually laid out horizontally, although other presentations
+of tab navigation such as using a drop-down list in the Action Bar (pattern docs at Android Design) are sometimes
+appropriate. Lastly, and most importantly, tabs should always run along the top of the
+screen, and should not be aligned to the bottom of the screen.
There are some obvious immediate benefits of tabs over simpler list- and button-based navigation:
diff --git a/docs/html/training/design-navigation/index.jd b/docs/html/training/design-navigation/index.jd
index cb20a606861ec..af60717144374 100644
--- a/docs/html/training/design-navigation/index.jd
+++ b/docs/html/training/design-navigation/index.jd
@@ -41,7 +41,9 @@ Relationships
- Learn about techniques for allowing users to navigate deep into, as well as across, your content hierarchy. Also learn about pros and cons of, and best practices for, specific navigational UI elements for various situations.
- Providing Ancestral and Temporal Navigation
- - Learn how to allow users to navigate upwards in the content hierarchy. Also learn about best practices for the BACK button and temporal navigation, or navigation to previous screens that may not be hierarchically related.
+ - Learn how to allow users to navigate upwards in the content hierarchy. Also learn about best
+practices for the Back button and temporal navigation, or navigation to previous screens
+that may not be hierarchically related.
- Putting it All Together: Wireframing the Example App
- Learn how to create screen wireframes (low-fidelity graphic mockups) representing the screens in a news application based on the desired information model. These wireframes utilize navigational elements discussed in previous lessons to demonstrate intuitive and efficient navigation.