title: Android : First digit is not displaying when using decimal input filter with NumberFormat
body: <p>In my android application I am using a <code>decimal</code> input filter to block the number of digits before decimal <code>seperator(.)</code> to 14 and after dot to 4, also using a <code>NumberFormat</code> with US locale to format the amount entered by user.I have noticed 2 problem when i try this as below.</p>
  
  <ul>
  <li>Can't enter decimal digits when there is 14 integer digits.Can enter <code>decimal</code> when there is less than 14 <code>Integer</code> digits.</li>
  <li><p>When change an amount greater than 999 then the first digit entered by user is not registering, I noticed that any number greater than 999 will formatted with a comma so when changing those amount with new amount the first digit typed will not come, why so.Suppose the <code>Edittext</code> contain the amount 4,000.00 and then changed to 9500 then only 500 is displayed.but when we change an amount like 450.00 there is no comma then no problem,all digit will come.Below is my code.</p>
  
  <p><code>NumberFormat formatUsTwo = NumberFormat.getInstance(Locale.US);</code></p>
  
  <pre><code>edtAmount=(EditText) v.findViewById(R.id.edtAmount);
  edtAmount.setFilters(new InputFilter[] {new DecimalDigitsInputFilter(14,4)});
  edtAmount.setText(formatUsTwo.format(9000));
  
  edtAmount.setOnFocusChangeListener(new View.OnFocusChangeListener() {
  @Override
  public void onFocusChange(View view, boolean hasFocus) {
  if(!hasFocus){
  Double  change=Double.parseDouble(edtAmount.getText().toString().trim().replace(",", ""));
                      edtAmount.setText(formatUsTwo.format(change));
                  }else{
                      onFocus(view, holder);
                  }
              }
          });
  
  
  
  public class DecimalDigitsInputFilter implements InputFilter {
  Pattern mPattern;
  public DecimalDigitsInputFilter(int digitsBeforeZero, int digitsAfterZero) {
                  mPattern = Pattern.compile("[0-9]{0," + (digitsBeforeZero - 1) + "}+((\\.[0-9]{0," + (digitsAfterZero - 1) + "})?)||(\\.)?");
              }
  
  @Override
  public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend) {
                  Matcher matcher = mPattern.matcher(dest);
                  if (!matcher.matches())
                      return "";
                  return null;
              }
          }
  </code></pre></li>
  </ul>