diff options
Diffstat (limited to 'docs')
15 files changed, 170 insertions, 99 deletions
diff --git a/docs/html/guide/practices/tablets-and-handsets.jd b/docs/html/guide/practices/tablets-and-handsets.jd index 3f4aaa9..8e07a08 100644 --- a/docs/html/guide/practices/tablets-and-handsets.jd +++ b/docs/html/guide/practices/tablets-and-handsets.jd @@ -99,7 +99,8 @@ side.</p> <p>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 <em>Back</em> button behavior with the option to +navigate to your application's "home" activity or "up" the application's structural hierarchy.</p> <p>This guide provides some tips for using the action bar in ways that support both tablets and @@ -458,7 +459,8 @@ attribute.</p> 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 <em>Back</em> 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.</p> 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 5faa7ec..9be72ee 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 <li><a href=#activities_added_to_task_tip>Allow activities to add to current task</a></li> <li><a href=#notifications_get_back_tip>Notifications and App Widgets should provide consistent back behavior</li> <li><a href=#use_notification_tip>Use the notification system</a></li> - <li><a href=#taking_over_back_key>Don't take over BACK key unless you absolutely need to</a></li> + <li><a href=#taking_over_back_key>Don't take over <em>Back</em> button unless you absolutely +need to</a></li> </ol> </li> </ol> @@ -241,8 +242,8 @@ independent of the other Android system keeps a linear navigation history of activities the user has visited. This is the <em>activity stack</em>, also known as the back stack. In general, when a user starts a new activity, it is added - to the activity stack, so that pressing BACK displays the previous - activity on the stack. However, the user cannot use the BACK key to go + to the activity stack, so that pressing <em>Back</em> displays the previous + activity on the stack. However, the user cannot use the <em>Back</em> button to go back further than the last visit to Home. The adding of an activity to the current stack happens whether or not that activity begins a new <a href=#tasks title=task>task</a> (as long as that task was started @@ -256,10 +257,11 @@ independent of the other Activities are the only things that can be added to the activity stack — views, windows, menus, and dialogs cannot. That is, when designing the navigation, if you have screen A and you want the user - to be able go to a subsequent screen B and then use the BACK key to go + to be able go to a subsequent screen B and then use the <em>Back</em> button to go back to screen A, then the screen A needs to be implemented as an activity. The one exception to this rule is if your application - <a href="#taking_over_back_key">takes control of the BACK key</a> and manages the navigation + <a href="#taking_over_back_key">takes control of the <em>Back</em> button</a> and manages the +navigation itself. </p> @@ -287,7 +289,7 @@ itself. launcher, Home screen shortcut or "Recent tasks" switcher (a long press on Home on some devices). The user can return to a task by choosing the icon for its root activity the same way they started the - task. Once inside a task, the BACK key goes to previous activities in + task. Once inside a task, the <em>Back</em> button goes to previous activities in that task. The activity stack is made up of one or more tasks. </p> @@ -331,7 +333,7 @@ itself. Browser are two applications that do this. For example, choosing an address in an email starts the Maps activity as a new task, and choosing a link in an email starts the Browser activity as a new - task. In these cases, the BACK key will return to the previous + task. In these cases, the <em>Back</em> button will return to the previous activity in a different task (Email), because it was not started from Home. </p> @@ -341,7 +343,7 @@ itself. <p> The following examples illustrate basic principles for applications, - activities, the activity stack, the BACK key, tasks and intents. It + activities, the activity stack, the <em>Back</em> 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. <img src={@docRoot}images/activity_task_design/HomeTaskBasics1a.png> </p> -<h3 id=navigating_away_from_an_activity>Navigating Away from an Activity with BACK and HOME keys</h3> +<h3 id=navigating_away_from_an_activity>Navigating Away from an Activity with <em>Back</em> and +<em>Home</em> buttons</h3> <p> 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 <em>Home</em> or <em>Back</em> button. </p> <p> - By default, pressing the BACK key finishes (destroys) the current + By default, pressing the <em>Back</em> 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 <em>Back</em> 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. </p> <p> - In the above example, pressing BACK goes to Home because it was the + In the above example, pressing <em>Back</em> 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 <em>Back</em> would have returned there. </p> <p> By contrast, the next figure shows the user leaving List Messages by - pressing HOME instead of BACK — the List Messages activity is + pressing <em>Home</em> instead of <em>Back</em> — 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. <p> 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 <em>Back</em> is pressed. When the user starts playing music in + the Music application and then presses <em>Back</em>, 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 <em>Menu</em> > 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. <b>Gallery Re-Uses Messaging for Sharing a Picture</b> - 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 <em>Menu</em> > 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 <em>Back</em> button. (The user can back up through each activity all the way to Home.) </p> @@ -552,7 +555,7 @@ itself. <ul> <li> State 2 - The user wants to do something else while they're - waiting, so they press HOME, which does not interrupt the map's + waiting, so they press <em>Home</em>, which does not interrupt the map's network connection and allows the map to continue loading in the background. @@ -729,7 +732,7 @@ href="{@docRoot}guide/topics/intents/intents-filters.html">Intents and Intent Fi <b>Start first task.</b> You want to send a text message and attach a photo. You would choose: <p> - Home > Messaging > New message > MENU > Attach + Home > Messaging > New message > <em>Menu</em> > 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 <em>Back</em> 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. </p> -<h3 id=taking_over_back_key>Don't take over the BACK key unless you absolutely need to</h3> +<h3 id=taking_over_back_key>Don't take over the <em>Back</em> button unless you absolutely need +to</h3> <p> 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 <em>Back</em> 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 <em>Back</em> 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 + <em>Back</em> button and maintain their own internal back stacks that operate only when these applications have focus. </p> @@ -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 <em>Back</em> button can return to a previous layer. </p> @@ -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 <em>Back</em> would to the search results page. Pressing + <em>Back</em> 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 3edf33f..7576b6c 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 <ul> <li>The <em>Options menu</em> contains primary functionality that applies globally to the current activity or starts a related activity. - It is typically invoked by a user pressing a hard button, often labeled MENU.</li> + It is typically invoked by a user pressing a hard button, often labeled <em>Menu</em>.</li> <li>The <em>Context menu</em> contains secondary functionality for the currently selected item. It is typically invoked by a user's touch & hold on an item. Like on the Options menu, the operation can run either @@ -109,10 +109,10 @@ or device to another. </p> <p> - On most devices, a user presses the MENU button to access the Options menu, + On most devices, a user presses the <em>Menu</em> 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 + <em>Menu</em> again, or presses the <em>Back</em> button. + In fact, to cancel out of any menu, press the <em>Back</em> button. (Pressing the <em>Menu</em> button or touching outside the menu also works.) Note that how to invoke this menu may be different on different devices. </p> @@ -140,7 +140,7 @@ or device to another. <ul> <li> - <b>Options icon menu</b> - The first press of the MENU button displays a + <b>Options icon menu</b> - The first press of the <em>Menu</em> button displays a non-scrollable grid of icons at the bottom of the screen. (On the G1 phone, up to 6 buttons typically appear.) </li> @@ -156,7 +156,7 @@ or device to another. <p> 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 <em>Menu</em> button — the text in the icon menu alternates between the command names and their keyboard shortcuts (if any). </p> @@ -299,7 +299,7 @@ or device to another. <a href="#location">location</a>) 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 <em>Menu</em> 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. <p> 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 <em>Menu</em> button), and so is not particularly discoverable. Therefore, in general, a Context menu should <em>duplicate</em> commands found in the corresponding activity screen. For example, while it's useful to @@ -459,7 +459,8 @@ or device to another. <h3 id="a_dialog_should_not_have_an_options_menu">A dialog should not have an Options menu</h3> <p> - When a dialog is displayed, pressing the MENU button should do nothing. This also holds true + When a dialog is displayed, pressing the <em>Menu</em> 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. <h3 id="do_not_substitute_message">If an activity has no Options menu, do not display a message</h3> <p> - When the user presses the MENU button, if there is no Options menu, the system + When the user presses the <em>Menu</em> 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 3b31199..8736aa8 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 <em>Back</em> button, it is popped from the stack (and destroyed) and the previous activity resumes. (The back stack is discussed more in the <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a> document.)</p> @@ -649,7 +649,8 @@ remains intact.</p> <p class="note"><strong>Note:</strong> 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 <em>Back</em> 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 e8f6cd8..d4f9342 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.</p> +by pressing the <em>Back</em> button.</p> <p>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).</li> <li>Pop fragments off the back stack, with {@link -android.app.FragmentManager#popBackStack()} (simulating a BACK command by the user).</li> +android.app.FragmentManager#popBackStack()} (simulating a <em>Back</em> command by the user).</li> <li>Register a listener for changes to the back stack, with {@link android.app.FragmentManager#addOnBackStackChangedListener addOnBackStackChangedListener()}.</li> </ul> @@ -439,7 +439,7 @@ to the activity, you must call {@link android.app.FragmentTransaction#commit()}. android.app.FragmentTransaction#commit()}, however, you might want to call {@link android.app.FragmentTransaction#addToBackStack addToBackStack()}, in order to add the transaction to a back stack of fragment transactions. This back stack is managed by the activity and allows -the user to return to the previous fragment state, by pressing the BACK key.</p> +the user to return to the previous fragment state, by pressing the <em>Back</em> button.</p> <p>For example, here's how you can replace one fragment with another, and preserve the previous state in the back stack:</p> @@ -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.</p> +previous fragment by pressing the <em>Back</em> button.</p> <p>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.</p> +back stack as a single transaction and the <em>Back</em> button will reverse them all together.</p> <p>The order in which you add changes to a {@link android.app.FragmentTransaction} doesn't matter, except:</p> @@ -696,7 +696,7 @@ document.</p> <p>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 <a +to it with the <em>Back</em> button, as discussed in <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">Tasks and Back Stack</a>). 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 086ba71..465cf54 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.</p> 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.</p> +desireable for the user to navigate back to reveal fragment B, using the <em>Back</em> button.</p> <p>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 <p>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 +<em>Back</em> 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 <em>Back</em> 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.</p> <img src="{@docRoot}images/fundamentals/diagram_backstack.png" alt="" /> <p class="img-caption"><strong>Figure 1.</strong> 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 <em>Back</em> button, the current +activity is destroyed and the previous activity resumes.</p> -<p>If the user continues to press BACK, then each activity in the stack is popped off to reveal the +<p>If the user continues to press <em>Back</em>, 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.</p> @@ -124,11 +128,13 @@ class="img-caption"><strong>Figure 3.</strong> A single activity is instantiated </div> <p>A 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 <em>Home</em> 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 <em>Home</em> +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 <em>Home</em> button to reveal recent tasks +and selecting one). This is an example of multitasking on Android.</p> <p class="note"><strong>Note:</strong> 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 <em>Back</em> 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 <a href="#ManagingTasks">Managing Tasks</a>.</p> @@ -161,13 +169,15 @@ href="#ManagingTasks">Managing Tasks</a>.</p> <ul> <li>When Activity A starts Activity B, Activity A is stopped, but the system retains its state (such as scroll position and text entered into forms). -If the user presses the BACK button while in Activity B, Activity A resumes with its state +If the user presses the <em>Back</em> button while in Activity B, Activity A resumes with its state restored.</li> - <li>When the user leaves a task by pressing the HOME button, the current activity is stopped and + <li>When the user leaves a task by pressing the <em>Home</em> button, the current activity is +stopped and its task goes into the background. The system retains the state of every activity in the task. If the user later resumes the task by selecting the launcher icon that began the task, the task comes to the foreground and resumes the activity at the top of the stack.</li> - <li>If the user presses the BACK button, the current activity is popped from the stack and + <li>If the user presses the <em>Back</em> button, the current activity is popped from the stack +and destroyed. The previous activity in the stack is resumed. When an activity is destroyed, the system <em>does not</em> retain the activity's state.</li> <li>Activities can be instantiated multiple times, even from other tasks.</li> @@ -256,7 +266,8 @@ flags to define how activities are associated with tasks and how the behave in t <p class="caution"><strong>Caution:</strong> 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 <em>Back</em> button. +Be sure to test for navigation behaviors that might conflict with the user's expected behavior.</p> @@ -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"}.</p> <p class="note"><strong>Note:</strong> 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 <em>Back</em> button to return to the previous activity. But when an existing +instance of +an activity handles a new intent, the user cannot press the <em>Back</em> button to return to the +state of the activity before the new intent arrived in {@link android.app.Activity#onNewIntent onNewIntent()}.</p> </dd> @@ -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. <p class="note"><strong>Note:</strong> Although the activity starts in a new task, the -BACK button still returns the user to the previous activity.</p></dd> +<em>Back</em> button still returns the user to the previous activity.</p></dd> <dt>{@code "singleInstance"}.</dt> <dd>Same as {@code "singleTask"}, except that the system doesn't launch any other activities into the task holding the instance. The activity is always the single and only member of its task; @@ -351,7 +364,7 @@ already has a task running in the background, that task is brought forward to ha intent.</p> <p>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 <em>Back</em> 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.</p> -<p>If this flag causes an activity to begin a new task and the user presses the HOME button to leave +<p>If this flag causes an activity to begin a new task and the user presses the <em>Home</em> 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 <em>Home</em> 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. </p> diff --git a/docs/html/guide/topics/intents/intents-filters.jd b/docs/html/guide/topics/intents/intents-filters.jd index 3f94553..3ad3c93 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: </tr><tr> <td>{@code CATEGORY_HOME} <td>The activity displays the home screen, the first screen the user sees when - the device is turned on or when the HOME key is pressed. + the device is turned on or when the <em>Home</em> button is pressed. </tr><tr> <td>{@code CATEGORY_LAUNCHER} <td>The activity can be the initial activity of a task and is listed in diff --git a/docs/html/guide/topics/manifest/activity-element.jd b/docs/html/guide/topics/manifest/activity-element.jd index e76a6be..4d9603f 100644 --- a/docs/html/guide/topics/manifest/activity-element.jd +++ b/docs/html/guide/topics/manifest/activity-element.jd @@ -133,21 +133,21 @@ is meaningful only for activities that start a new task (the root activity); it's ignored for all other activities in the task. <p> -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 <em>Back</em> or <em>Home</em> button to +leave it. When the value is "{@code false}", the task may be cleared of activities in some situations (see the <code><a href="#always">alwaysRetainTaskState</a></code> attribute), but not always. </p> <p> 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 <em>Home</em>, 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 +<em>Home</em> and the task went to the background. So the user sees only P when returning to the task. </p> @@ -501,7 +501,7 @@ users and is very different from most other applications. <p>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. </p> +other activities and tasks using the <em>Back</em> button. </p> <p>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 e06563d..8b8e75b 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() { } </pre> -<p>If the user cancels search by pressing the BACK button, the search dialog closes and the activity +<p>If the user cancels search by pressing the <em>Back</em> 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:</p> 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 <em>Back</em> button goes back to the +previous instance of the searchable activity, rather than exiting the searchable activity).</li> <li>If you set {@code android:launchMode} to <code>"singleTop"</code>, 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 d3060c5..83c8150 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</a> document.</p> <p>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 <em>Menu</em> 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.</p> <p>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 bef9671..d104b4b 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: </li> <li> The user has seen enough to know they have a meeting coming up, - so they press the BACK button. They are now returned to Email, which + so they press the <em>Back</em> button. They are now returned to Email, which is where they were when they took the notification. </li> </ol> @@ -198,8 +198,8 @@ in these two typical notification flows, first handling a Calendar notification: (writing an e-mail), but that message is still saved in their drafts. </li> <li> - The user presses BACK once to go to the message list (the typical flow in the - Email app), and press BACK again to return to Calendar as they left it. + The user presses <em>Back</em> once to go to the message list (the typical flow in the + Email app), and press <em>Back</em> again to return to Calendar as they left it. </li> </ol> @@ -216,7 +216,7 @@ new notification state.</p> most interest is the <code>makeMessageIntentStack()</code> 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 <em>Back</em> 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 ed28f21..66b5501 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()}.</p> -<p>For example, here's how your {@link android.app.Activity} can use the device BACK key to navigate -backward:</p> +<p>For example, here's how your {@link android.app.Activity} can use the device <em>Back</em> button +to navigate backward:</p> <pre> @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 c0b1aef..ab6a64d 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 </div> -<p>Now that users can navigate <a href="descendant-lateral.html">deep into</a> 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.</p> +<p>Now that users can navigate <a href="descendant-lateral.html">deep into</a> 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 <em>Back</em> +button is respected to respect Android conventions.</p> <div class="design-announce"> <p><strong>Back/Up Navigation Design</strong></p> @@ -39,27 +42,52 @@ next.link=wireframing.html <h2 id="temporal-navigation">Support Temporal Navigation: <em>Back</em></h2> -<p>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.</p> +<p>Temporal navigation, or navigation between historical screens, is deeply rooted in the Android +system. All Android users expect the <em>Back</em> 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 <em>Back</em> enough times should land +you back at the Launcher, after which the <em>Back</em> button will do nothing.</p> <img src="{@docRoot}images/training/app-navigation-ancestral-navigate-back.png" - alt="The BACK button behavior after entering the Email app from the People (or Contacts) app" id="figure-navigate-back"> + alt="The Back button behavior after entering the Email app from the People (or Contacts) app" +id="figure-navigate-back"> -<p class="img-caption"><strong>Figure 1.</strong> The BACK button behavior after entering the Email app from the People (or Contacts) app.</p> +<p class="img-caption"><strong>Figure 1.</strong> The <em>Back</em> button behavior after entering +the Email app from the People (or Contacts) app.</p> -<p>Applications generally don't have to worry about managing the BACK button themselves; the system handles <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">tasks and the <em>back stack</em></a>, 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.</p> +<p>Applications generally don't have to worry about managing the <em>Back</em> button themselves; +the system handles <a href="{@docRoot}guide/topics/fundamentals/tasks-and-back-stack.html">tasks and +the <em>back stack</em></a>, or the list of previous screens, automatically. The <em>Back</em> +button by default simply traverses this list of screens, removing the current screen from the list +upon being pressed.</p> -<p>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 <em>back</em> 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.</p> +<p>There are, however, cases where you may want to override the behavior for <em>Back</em>. 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 <em>back</em> +behavior when users press the device's <em>Back</em> button. Upon reaching the beginning of the +browser's internal history, you should always defer to the system's default behavior for the +<em>Back</em> button.</p> <h2 id="ancestral-navigation">Provide Ancestral Navigation: <em>Up</em> and <em>Home</em></h2> -<p>Before Android 3.0, the most common form of ancestral navigation was the <em>Home</em> metaphor. This was generally implemented as a <em>Home</em> item accessible via the device's MENU button, or a <em>Home</em> button at the top-left of the screen, usually as a component of the Action Bar (<a href="{@docRoot}design/patterns/actionbar.html">pattern docs</a> at Android Design). Upon selecting <em>Home</em>, the user would be taken to the screen at the top of the screen hierarchy, generally known as the application's home screen.</p> +<p>Before Android 3.0, the most common form of ancestral navigation was the <em>Home</em> metaphor. +This was generally implemented as a <em>Home</em> item accessible via the device's <em>Menu</em> +button, or a <em>Home</em> button at the top-left of the screen, usually as a component of the +Action Bar (<a href="{@docRoot}design/patterns/actionbar.html">pattern docs</a> at Android Design). +Upon selecting <em>Home</em>, the user would be taken to the screen at the top of the screen +hierarchy, generally known as the application's home screen.</p> <p>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 <em>Home</em> to arrive back at the familiar home screen.</p> -<p>Android 3.0 introduced the <em>Up</em> metaphor, which is presented in the Action Bar as a substitute for the <em>Home</em> button described above. Upon tapping <em>Up</em>, 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 <em>Up</em> for each screen navigates to a single, predetermined parent screen.</p> +<p>Android 3.0 introduced the <em>Up</em> metaphor, which is presented in the Action Bar as a +substitute for the <em>Home</em> button described above. Upon tapping <em>Up</em>, the user should +be taken to the parent screen in the hierarchy. This navigation step is usually the previous screen +(as described with the <em>Back</em> button discussion above), but this is not universally the case. +Thus, developers must ensure that <em>Up</em> for each screen navigates to a single, predetermined +parent screen.</p> <img src="{@docRoot}images/training/app-navigation-ancestral-navigate-up.png" @@ -70,6 +98,12 @@ next.link=wireframing.html <p>In some cases, it's appropriate for <em>Up</em> 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 <a href="multiple-sizes.html">previous lesson</a>. However, when viewing a mail conversation in the portrait orientation, only the conversation details are shown. The <em>Up</em> button is used to temporarily show the parent pane, which slides in from the left of the screen. Pressing the <em>Up</em> button again while the left pane is visible exits the context of the individual conversation, up to a full-screen list of conversations.</p> -<p class="note"><strong>Implementation Note:</strong> As a best practice, when implementing either <em>Home</em> or <em>Up</em>, make sure to clear the back stack of any descendent screens. For <em>Home</em>, the only remaining screen on the back stack should be the home screen. For <em>Up</em> 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.</p> +<p class="note"><strong>Implementation Note:</strong> As a best practice, when implementing either +<em>Home</em> or <em>Up</em>, make sure to clear the back stack of any descendent screens. For +<em>Home</em>, the only remaining screen on the back stack should be the home screen. For +<em>Up</em> navigation, the current screen should be removed from the back stack, unless +<em>Back</em> 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.</p> <p>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.</p> diff --git a/docs/html/training/design-navigation/descendant-lateral.jd b/docs/html/training/design-navigation/descendant-lateral.jd index 0064bd4..2d97e40 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 <p class="img-caption"><strong>Figure 5.</strong> Example phone and tablet tab-based navigation interfaces with relevant screen map excerpt.</p> -<p>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 <em>A</em> to another tab <em>B</em>, pressing the BACK button (more on that in the <a href="ancestral-temporal.html">next lesson</a>) should not re-select tab <em>A</em>. Tabs are usually laid out horizontally, although other presentations of tab navigation such as using a drop-down list in the Action Bar (<a href="{@docRoot}design/patterns/actionbar.html">pattern docs</a> at Android Design) are sometimes appropriate. Lastly, and most importantly, <em>tabs should always run along the top of the screen</em>, and should not be aligned to the bottom of the screen.</p> +<p>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 <em>A</em> to another tab <em>B</em>, pressing the +<em>Back</em> button (more on that in the <a href="ancestral-temporal.html">next lesson</a>) should +not re-select tab <em>A</em>. Tabs are usually laid out horizontally, although other presentations +of tab navigation such as using a drop-down list in the Action Bar (<a +href="{@docRoot}design/patterns/actionbar.html">pattern docs</a> at Android Design) are sometimes +appropriate. Lastly, and most importantly, <em>tabs should always run along the top of the +screen</em>, and should not be aligned to the bottom of the screen.</p> <p>There are some obvious immediate benefits of tabs over simpler list- and button-based navigation:</p> diff --git a/docs/html/training/design-navigation/index.jd b/docs/html/training/design-navigation/index.jd index cb20a60..af60717 100644 --- a/docs/html/training/design-navigation/index.jd +++ b/docs/html/training/design-navigation/index.jd @@ -41,7 +41,9 @@ Relationships</a></strong></dt> <dd>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.</dd> <dt><strong><a href="ancestral-temporal.html">Providing Ancestral and Temporal Navigation</a></strong></dt> - <dd>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.</dd> + <dd>Learn how to allow users to navigate upwards in the content hierarchy. Also learn about best +practices for the <em>Back</em> button and temporal navigation, or navigation to previous screens +that may not be hierarchically related.</dd> <dt><strong><a href="wireframing.html">Putting it All Together: Wireframing the Example App</a></strong></dt> <dd>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.</dd> |