Reproduced please specify the Source: Android Learning Route (25) comprehensive understanding of Android navigation logic
The consistency of application navigation is an important part of the overall user experience, and if the app is not navigating the same way, the user will not be able to understand quickly, then this application can give users a great sense of frustration, greatly affecting the user experience.
After Android 3.0, the system described its significant changes in global navigation performance. A comprehensive understanding of "back" and "up" navigation and meaning, can greatly reduce the user's learning time, users in the process can quickly learn how to switch between the various interfaces of the application.
Android 2.3 and its previous systems have been navigated by the "Back" button for the app. Actionbar, which appears after Android 3.0, brings another consistent way of navigating: "Up", which is located on the leftmost side of Actionbar, and is usually made up of the app's icon and title.
Examples of "back" and "up" were shown:
Up vs. back The navigation logic for up is determined by the hierarchical structure of the interface. For example a interface has a list, click on the list of item to enter the B interface, this time, in the B interface should provide a up button, click Up should return to the A interface.
If an interface is the main interface of the app, then this interface does not need to provide the up button, and the Back button will work on all interfaces.
In the application, back is the function of returning to the previous interface. If you consider an open interface as a stack, then clicking the Back button will undoubtedly represent the stack, and the user should always be able to find the previous interface through the back operation.
If the previous interface of the current interface is exactly the parent interface of the current interface, then back and up are the same effect. However, up is primarily used inside the app, while back allows the user to return to the main interface of the phone and even go back to other apps.
To give a simple example:
Click on the Gmail app in the main screen of the phone and go to the Gmail main screen, where the main interface contains a list of messages, and clicking on one of the sessions will enter the conversation details screen. On the Session Details page, the previous interface and the interface's ancestor interface are the session list interface, so clicking back and up is the same effect and will return to the session list interface. It can be found that the main interface of the conversation list-based Gmail, so there is no up button on this interface, this time you can click Back to return to the main screen of the phone.
Back, besides being able to handle the switching between these interfaces, it can also handle some of the navigation logic on the unified interface, such as:
Click Back to let the current interface of the dialog box disappears, but also to remove the current interface text highlighting, but also can hide the input keyboard and so on.
single app Internal navigation
When an interface has a lot of portals, clicking the Up button in this interface should go back to the relevant interface, which has the same effect as back to the previous interface. For example, to set up the interface, there may be many places in the application to enter the settings interface, when clicking Up and back will return to its previous interface.
If you switch views within an interface, such as an interface that contains Viewpager, while the left and right slides cause the view to change on the interface, the interface does not change at the interface level of the app, nor does it create a new navigation history, so it does not cause new behavior in the up and back.
For example:
Click on one of the sessions in the session list interface, go to details, swipe around the details page to see the details of the session, but this does not switch the interface (at the level of the app interface), so this does not affect back and up effects.
However, if you click on a button on the Details page to enter another detail interface, a navigation history is created at this time. In this case, clicking back will return to the previous interface on the Details page, and clicking Up will return to the top level interface in the app hierarchy.
For example:
We can also make navigation more intelligent, such as when we click on the item into the details page in a certain kind of list interface to jump to another type of detail page, click the back screen will go to the previous Detail page, and click Up will return to this type of List page, as shown in:
In the above explanation, we can understand the different roles and purposes of back and up. Users into the app, switch between different interfaces, each interface will be added to a stack, usually back to the role of return to the stack of the previous interface, and up and the stack is not directly related, in addition to the main interface, the other interface will have a parent interface, The function of up is to return to the parent interface of the current interface.
However, in order for the back effect to be more predictable, we should add the interface to the back of the interface stack, so that users can be more aware of how to get into the current interface. For example, when clicking on the Android desktop widgets into a non-app main interface, if not manually inserted into the interface stack of the main interface of the app, click Back to directly back to the phone home interface, this experience is not very good, so we will do the manual to insert the interface in the stack operation. The details are as follows:
Navigating across Apps
Back and up in the same app have different places in the same place, and there are more differences between back and up in the case of a Kua application.
To know the navigation effect of back and up across apps, you first need to know the following three concepts:
Activities: As we all know, an activity is an application component that displays an information interface that interacts with the user, and an app can be seen as a collection with multiple activities And these activities can either be defined by the app itself or reused for activity in other apps;
Task:task represents the process of a complete operation for a user. For example, a user opens an app, clicks on a shared content in an app's interface, and chooses to share it via email, a process called a task that sees the process as cross-app, and this task contains multiple activities;
Intent:intent indicates the intention of the interface jump, you can specify the interface jump, you can also be based on the interface support action jump. For example, the system "Share" this intent, it will be listed in the system of all support sharing app;
After understanding the above concepts, let's take a look at this example:
The user clicks share in an interface, jumps to Gmail to share the content, this process is a task, if click Back, then will return to the previous app, and if click Up, will stay in Gmail, and jump to Gmail's main interface (the parent interface of the current interface), This process is a new task. This new task will overwrite the old task, and click Back to return to the system home screen.
Throughout this article, we have learned about the recommended navigation guidelines for the system. We can follow the specifications, but in our app, we can also be specific analysis, in short, a principle is to allow users to learn to use the app faster, so that the interface navigation has better predictability.
This article roughly explains the new version of the Android system recommended navigation mechanism, for more detailed information, please refer to: Navigation with the back and up. I'll also show you how to implement up navigation in the next article Actionbar.
Android Learning Route (25) Full understanding of Android navigation logic