Tracing the Life Cycle of an Activity Dialog

Each Dialog window must be defined within the activity in which it will be used. A Dialog window may be launched once or used repeatedly. Understanding how an

activity manages the Dialog window life cycle is important to implementing a Dialog window correctly. Let's look at the key methods that an activity must use to manage a Dialog window:

► The showDialog() method is used to display a Dialog window.

► The dismissDialog() method is used to stop showing a Dialog window. The Dialog window is kept around in the activity's Dialog window pool. If the Dialog window is shown again, using showDialog(), the cached version is displayed once more.

► The removeDialog() method is used to remove a Dialog window from the Activity object's Dialog window pool. The Dialog window will no longer be kept around for future use. If you call showDialog() again, the Dialog window must be re-created.

0 0

Post a comment