I want to have EditText that automatically formats user input in real time, for example, it converts 1000000 to 1,000,000
I tried Android Money Input with fixed decimal but when I set the text, the app crashes
EditText etMoney;
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    etMoney = (EditText)findViewById(R.id.etMoney);
    etMoney.addTextChangedListener(new TextWatcher() {
        @Override
        public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {
        }
        @Override
        public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {
            etMoney.setText(currencyFormat(etMoney.getText().toString()));
        }
        @Override
        public void afterTextChanged(Editable editable) {
        }
    });
}
public static String currencyFormat(String amount) {
    DecimalFormat formatter = new DecimalFormat("###,###,###");
    return formatter.format(Double.parseDouble(amount));
}
The output I want is a real-time converter directly into the EditText but as soon as I type something in EditText the app crashes.
Crash Log:
06-20 15:19:57.453 1699-1715/system_process E/ActivityManager: ANR in com.hassilproject.myapplication (com.hassilproject.myapplication/.MainActivity)
                                                               PID: 2521
                                                               Reason: Input dispatching timed out (Waiting to send key event because the focused window has not finished processing all of the input events that were previously delivered to it.  Outbound queue length: 0.  Wait queue length: 1.)