Android Dialogの表示

AlertDialogの表示方法です。

public class MainActivity extends Activity {

    public void showDialog() {

		nameText = new EditText(this);
		nameText.setHint("Enter Your Name.");
		nameText.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD);
		nameText.setMaxLines(1);

		AlertDialog.Builder builder = new AlertDialog.Builder(this);
		builder.setMessage("Enter Your Name?");
		builder.setView(nameText);
		builder.setCancelable(false);
		builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
		           public void onClick(DialogInterface dialog, int id) {

		        	   dialog.cancel();
		        	   String nickname = nameText.getText().toString();
		        	   PlayerInfo.regisetNickName(nickname);
		        	   registScoreRanking();
		        	   moveToScoreRanking();
		        	   

		           }
		       });
		builder.setNegativeButton("CANCEL", new DialogInterface.OnClickListener() {
		           public void onClick(DialogInterface dialog, int id) {
		                dialog.cancel();
		           }
		       });

		AlertDialog alert = builder.create();
		alert.show();

    }