Among all the AlertDialog usages, this alert is the simplest: it informs the user about a situation that requires a simple choice based on the dialog confirmation message or acknowledgement. When implementing this type of alert, you can use a title, a message, and an icon to show the message with severity. It only uses a message text in the content area. The title area is optional; it can be any text or icon but it is primarily used to show severities or appropriate categories that users immediately understand.
In the Dialogs app, show an alert view when the alertButton is tapped. The following is an AlertDialog usage quick overview:
- Use AlertDialog.builder to create an AlertDialog instance.
- Set the Title text.
- Set the Message text.
- Add Buttons ...
Get Migrating to Android for iOS Developers now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.