KevinM - 7 days ago 6

Android Question

I need help to only allow one decimal point to be entered into a

`EditText`

`123.45.2`

`123..452`

Answer

Play around with this however you like it.

```
myEditText.setKeyListener(DigitsKeyListener.getInstance(true,true));
```

Returns a DigitsKeyListener that accepts the digits 0 through 9, plus the minus sign (only at the beginning) and/or decimal point (only one per field) if specified.