Skip to content

Dialogs


Prepared and tested with Android Studio and Java (2018-04-03)

Table of contents


Project description

With this application we can practise very basic modal dialogs.

Requirements:

  • There are five buttons on the main screen
    • Simple
    • Simple list
    • List with radio
    • List with checkboxes
    • Custom
  • When Simple is pressed a simple modal dialog, with
    • a title,
    • a message,
    • three buttons: Yes, No and Cancel

    should be displayed. When Yes, No or Cancel is pressed a Toast with message identifying the pressed button should be displayed.

  • When Simple list is pressed a modal dialog with a simple list should be displayed.
  • When List with radio is pressed a modal dialog with a radio button elements should be displayed.
  • When List with checkboxes is pressed a modal dialog with a checkbox elements should be displayed.
  • When Custom is pressed a custom modal dialog with a custom layout should be displayed.

All the information needed to complete this project can be found in Materials section.


How it should work

  1. When started a main view (activity) should be visible with a set of buttons defined in requirements (Project description section)
  2. Press Simple button. A simple modal dialog, with a title, a message, three buttons should be displayed
  3. When Yes, No or Cancel is pressed a dialog should be closed and a Toast with message identifying the pressed button should be displayed.
  4. Press Simple list button. A modal dialog with a simple list should be displayed
  5. When list item is selcted a dialog should be closed and a Toast with message identifying the list item should be displayed.
  6. Press List with radio button. A modal dialog with a radio button elements should be displayed
  7. When a modal dialog with a radio button elements is displeyed, some buttons should be selected by default.
  8. Every time we check/uncheck a radio button a Toast should be displayed (see List with checkboxes description below).
  9. Press List with checkboxes button. A modal dialog with a checkbox elements should be displayed
  10. When a modal dialog with a checkbox elements is displeyed, some buttons should be selected by default.
  11. Every time we check/uncheck a checkbox a Toast should be displayed.
  12. Press Custom button. A custom modal dialog with a custom layout should be displayed
  13. When an accept button (Yes) is pressed a Toast should be displayed


Source code

For this project the following files were created

Complete project


Materials