title: EditText with Currency format
body: <p>I have a EditText in which I want to display currency:</p>
  
  <pre><code>    input.setInputType(InputType.TYPE_CLASS_NUMBER);
      input.addTextChangedListener(new CurrencyTextWatcher());
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>public class CurrencyTextWatcher implements TextWatcher {
  
  boolean mEditing;
  
  public CurrencyTextWatcher() {
      mEditing = false;
  }
  
  public synchronized void afterTextChanged(Editable s) {
      if(!mEditing) {
          mEditing = true;
  
          String digits = s.toString().replaceAll("\\D", "");
          NumberFormat nf = NumberFormat.getCurrencyInstance();
  
          try{
              String formatted = nf.format(Double.parseDouble(digits)/100);
              s.replace(0, s.length(), formatted);
          } catch (NumberFormatException nfe) {
              s.clear();
          }
  
          mEditing = false;
      }
  }
  </code></pre>
  
  <p>I want to user to see a number-only keyboard, that is why I call </p>
  
  <pre><code>input.setInputType(InputType.TYPE_CLASS_NUMBER);
  </code></pre>
  
  <p>on my EditText. However, it does not work. I see the numbers as typed in without any formatting. BUT: If I DO NOT set the inputType via input.setInputType(InputType.TYPE_CLASS_NUMBER), the formatting works perfectly. But the user must use the regular keyboard, which is not nice. How can I use the number keyboard and also see the correct currency formatting in my EditText? Thanks.</p>