Launching the Custom Password Dialog

A custom dialog, such as your password dialog, is launched the same way as a regular dialog: using the showDialog() method of the activity. On the settings screen of the Been There, Done That! application, the user triggers the custom password dialog to launch by pressing the Button control called Button_Password. Therefore, you can register for click events on this Button control and launch the password dialog accordingly:

Button setPassword = (Button) findViewById(R.id.Button_Password); setPassword.setOnClickListener(new View.OnClickListener() { public void onClick(View v) {

showDialog(PASSWORD_DIALOG_ID);

Figure 11.6 shows the resulting settings screen, with Dialog controls.

Figure 11.6 shows the resulting settings screen, with Dialog controls.

FIGURE 11.6

The complete Been There, Done That! settings screen.

0 0

Post a comment