Adding a Custom Dialog to the Settings Screen

In the Been There, Done That! application, you want to include a custom dialog to handle entering and verifying a new password. Figure 11.3 shows the password dialog states (matching and not matching passwords).

FIGURE 11.3

A custom dialog used for handling password input.

Q Set Password

Q Set Password

Password (again):

Password (again):

, Pniwords matcli. t

Pglswydi'do not match, plcjtic try , again. , -C

The custom password dialog you want to create requires two text input fields for entering password data. When the two passwords match, the password will be set. Figure 11.4 shows a rough design of the settings screen in this case.

FIGURE 11.4

Rough design for the Been There, Done That! password dialog.

The password dialog is simply a subform of the settings screen that has two EditText input fields. You also need a TextView control below the input fields to tell the user whether the passwords match.

Figure 11.5 shows the layout design of the password dialog.

FIGURE 11.5

Layout design for the Been There, Done That! settings screen.

LinearLayout (Vertical Orientation)

TextView ("Password:")

i

EditText (Password #1 Input)

TextView ("Password (Again):")

EditText (Password #2 Input)

TextView (E.g. "Passwords Match")

You can take advantage of the built-in Button controls that can be configured for use with AlertDialog. The three buttons need not be included in your layout design.

0 0

Post a comment