Learn about the various circumstances under which your app needs to communicate information to the user and how to map those scenarios to the features.
- [Instructor] There are a wide variety of reasons and scenarios under which your app will have to communicate with the user. Sometimes, your app needs to let the user know that something happened in your app that needs their attention, or is just for their information. Sometimes, you need the user to make a decision about something, or supply some necessary information before the app can continue. Still other times, you might need to alert the user to something urgent. Android provides a set of different tools to facilitate these types of user communication scenarios.
These scenarios can be segmented into three main types: acknowledgement, confirmation, and notification. The acknowledgement scenario usually covers situations where your app wants to give the user some indication that an operation that they asked the app to perform has, in fact, happened. For example, when you archive an email message, or send someone a text, an app can display a small, unobtrusive message indicating that the message was actually archived or sent. The user doesn't necessarily need to interact with the message, it's just there to reassure them that things worked.
The confirmation scenario is a little different, because it involves interrupting the user's workflow so that they can either make a decision, or provide information that the app needs. Typically, an app asks the user for confirmation before performing a destructive operation, such as deleting a document. An app might also present an interruptive confirmation to ask for needed information, such as authentication credentials before accessing a sensitive resource. The notification scenario covers instances where an app needs to get the user's attention, even when they are not currently using the app.
An example of this might be when the user receives an incoming text message, or when some other important event of interest to the user, such as the result of a sporting event happens. For the acknowledgement scenario, your app can use either the toast message or Snackbar UI elements to provide quick, informative messages to the user. The confirmation scenario can be addressed by using dialogs. There are a variety of built-in dialog formats your app can use, or you can create your own. For presenting notifications to the user, apps can use the notification manager.
We'll see how each of these Android elements are used as we progress through the course.
- Communicating with toasts
- Displaying a snackbar
- Using snackbars with actions
- Creating simple dialogs and choice dialogs
- Returning results from a dialog
- Creating custom dialogs
- Displaying notifications
- Using NotificationCompat
- Working with expanded notifications