H
H
Horoko2015-05-30 15:36:41
Java
Horoko, 2015-05-30 15:36:41

How to change default Dialog template in Android?

Actually, there is AlerDialogBuilder with EditText added to it. I want to specify a minimum number of input characters in an EditText. How to do it? Once again, the dialogue template is standard.
In layout, I indicated android:maxLength = "16"
And in the code there is no such method, and a method that limits the number of minimum characters entered.
Dialog code:

AlertDialog.Builder alert = new AlertDialog.Builder(this);
        alert.setTitle("Заголовок");
        alert.setMessage("Сообщение");
        alert.setCancelable(false);

        final EditText input = new EditText(this);
        alert.setView(input);

        alert.setPositiveButton("ОК", new DialogInterface.OnClickListener() {
            public void onClick(DialogInterface dialog, int whichButton) {
                adminLogin = input.getText().toString();
            }
        });
        alert.show();

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2015-05-31
@mbelskiy

I give

O
one pavel, 2015-05-30
@onepavel

Subscribe to events from editText

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question