Working with Custom Dialogs

When the basic Dialog types do not suit your purpose, you can create a custom dialog. One easy way to create a custom dialog is to begin with AlertDialog and use an AlertDialog.Builder class to override its default layout. To create a custom dialog this way, follow these steps:

1. Design a custom layout resource to display in AlertDialog.

2. Define the custom Dialog identifier in the activity.

3. Update the activity's onCreateDialog() method to build and return the appropriate custom AlertDialog.

4. Launch the dialog using the showDialog() method.

Was this article helpful?

0 0

Post a comment