title: Android: EditText maxLength being ignored
body: <p>I have a problem where this EditText ignores my maxLength completely.</p>
  
  <pre><code>&lt;EditText
          android:id="@+id/dialog_input"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_margin="10dp"
          android:inputType="numberPassword"
          android:maxLength="4"
          android:singleLine="true"
          android:textColorHint="@color/primary_lighter"
          android:textColor="@color/accent_harder"
          android:hint="****"
          /&gt;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/957nb.png" alt="maxLength is ignored"></p>
  
  <p>I can input how many characters I want.</p>
  
  <p>This is a dialog and I cannot get the EditText by findViewById because its available programtaically when I press OK.</p>
  
  <pre><code>public void showNewQuestionDialog() {
      final AlertDialog.Builder builder = new AlertDialog.Builder( this );
      LayoutInflater inflater = this.getLayoutInflater();
      builder.setView( inflater.inflate( R.layout.dialog_question_new, null ) )
              .setPositiveButton( R.string.settings_ok, new  DialogInterface.OnClickListener() {
                  @Override
                  public void onClick( DialogInterface thisDialog, int id ) {
                      Dialog dialog2 = Dialog.class.cast( thisDialog );
                      EditText input = ( EditText ) dialog2.findViewById( R.id.dialog_input ); 
  
                      // Other code here..
                  }
              } );
       .....
  </code></pre>
  
  <p><strong>I solved it.</strong>
  The problem was this line:</p>
  
  <pre><code>        android:singleLine="true"
  </code></pre>
  
  <p>If you ever experience the same problem, try removing this line.</p>