title: how to set maximum and minimum character of a EditText field?
body: <p>set maximum and minimum length of EditText field which check its length as the user types and notify the user(like red color EditText line or small popup which don't intrupt typing). I dont know if this coding should be on xml or java file.</p>
  
  <p>take example of username:
  xml file </p>
  
  <pre><code>&lt;EditText
      android:id="@+id/etusername"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:hint="Username"
      android:inputType="textPersonName"
      android:maxLength="25"       
      android:digits="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890"/&gt;
  </code></pre>
  
  <p>.java file</p>
  
  <pre><code>EditText etUsername=(EditText) findViewById(R.id.etusername);
  String username=etUsername.getText().toString();
  btnRegister.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
               //any operation here
          }
  </code></pre>