title: android EditText alphabet-only validation
body: <p>i wanted to validate a EditText and see if all of the letters are alphabet. it should be able to handle multiple EditText. i need a way to prevent user from entering anything other then alphabet. </p>
  
  <pre><code>        userTextInput=(EditText)findViewById(R.id.textInput);
      userTextInput.addTextChangedListener(this);
  
      public void afterTextChanged(Editable edit) {
      String textFromEditView = edit.toString();
              //first method
      ArrayList[] ArrayList;
      //ArrayList [] = new ArrayList;
      for(int i=0; i&lt;=textFromEditView.length(); i++)
      {
          if(textFromEditView[i].isLetter() == false)
          {
              edit.replace(0, edit.length(), "only alphabets");
          }
      }
              //second method
      try
      {
          boolean isOnlyAlphabet = textFromEditView.matches("/^[a-z]+$/i");
          if(isOnlyAlphabet == false)
          {
              edit.replace(0, edit.length(), "only alphabets");
          }
      }
      catch(NumberFormatException e){}
  
  
  }
  </code></pre>
  
  <p>for my second method the moment i enter anything, number or alphabet, my app crash. 
  i have test my first method because it has the error textFromEditView must be an array type bue is resolved as string. can you help me to improve my code. </p>