title: formatting expiry date in mm/yy format
body: <p>Hi I am writing an edittext in which I want expiry date of the credit card in MM/YY format.
  The algorithm I want to implement is as follows: 
  If user enters anything from 2 to 9. I change the text input to 02/ to 09/
  If the user enters 1, then I wait for the next digit and check if the int value month if less than 12. 
  Here is my code for this.</p>
  
  <pre><code>@Override
              public void afterTextChanged(Editable s) { 
              String input = s.toString();
                  if (s.length() == 1) {
                          int month = Integer.parseInt(input);
                          if (month &gt; 1) {
                              mExpiryDate.setText("0" + mExpiryDate.getText().toString() + "/");
                              mExpiryDate.setSelection(mExpiryDate.getText().toString().length());
                              mSeperator = true;
                          }
  
                  }
                  else if (s.length() == 2) {
                          int month = Integer.parseInt(input);
                          if (month &lt;= 12) {
                              mExpiryDate.setText(mExpiryDate.getText().toString() + "/");
                              mExpiryDate.setSelection(mExpiryDate.getText().toString().length());                            
                              mSeperator = true;
                          }
                  }
                  else {
  
                  }
  
              }
  </code></pre>
  
  <p>This works fine until I press a softkey back button. The back slash never goes back. 
  The reason is the second if condition is always met.
  I am confused about how to solve this. How do I handle the back button inside aftertextchanged? Please help.</p>