Unit - 3 Working with Dialogs


Lesson Plan: Unit - 03
Subject: P15A2AAD - Android Application Development
Topic of Study: Working with Dialogs
Grade/Level: Master of Computer Applications
Objective: To understand life cycle of Dialog and different types of dialog demonstration
Time Allotment: 55 Minutes


  • Working with Dialogs
    • An Activity can use dialogs to organize information and react to user-driven events. 
    • Exa. an activity might display a dialog informing the user of a problem or ask the user to confirm an action such as deleting a data record. 
    • Using dialogs for simple tasks helps keep the number of application activities manageable.
    • There are different types: 
      • Dialog, 
      • AlertDialog, 
      • CharacterPickerDialog, 
      • TimerPickerDialog, 
      • DatePickerDialog, 
      • ProgressDialog.
    • Exa.
    • Lifecycle of a Dialog:
      • Each Dialog must be defined within the Activity in which it is used.
      • A Dialog may be launched once, or used repeatedly. 
      • Let’s look at the key methods that an Activity must use to manage a Dialog:
        • The showDialog() method is used to display a Dialog.
        • The dismissDialog() method is used to stop showing a Dialog. The Dialog is kept around in the Activity’s Dialog pool. If the Dialog is shown again using showDialog(), the cached version is displayed once more.
        • The removeDialog() method is used to remove a Dialog from the Activity objects Dialog pool. The Dialog is no longer kept around for future use. If you call showDialog() again, the Dialog must be re-created.
    • Exa. Simple Alert Dialog
    • Exa. Dialog with Yes/No Buttons

    • Exa. Date Picker Dialog
    • Exa. Timer Picker Dialog

Thanks a lot for query or your valuable suggestions related to the topic.

Previous Post Next Post

Contact Form