Initializing a Dialog

Because a Dialog window may be kept around by an activity, it may be important to re-initialize a dialog each time it is shown instead of just when it is created the first time. For this purpose, you can override the onPrepareDialog() method of the activity.

While the onCreateDialog() method may be called only once for initial dialog creation, the onPrepareDialog() method is called each time the showDialog() method is called, giving the activity a chance to initialize the dialog each time it is shown to the user.

Was this article helpful?

0 0

Post a comment