I am implementing EditText , and I am faced with one problem ... I assume that inputType is numberDecimal , but at the time I type on EditText , I would like to put "." or "," automatically ... I can specify, for example, 100.00 or 90.00 , it depends on the user ... Is this possible?
I tried creating a TextWatcher and doing some things on onTextChanged , for example, see if charSequence-lenght()==2 adds. "" . or "," but does not work ...
Can I determine when to put a comma or period, even if I have a decimal format, for example ##.## or ###.## ? As I said, it can be 100.00 or 80.00 .
Edit
@Override public void afterTextChanged(Editable editable) {
The problem in textInput is not on afterTextChanged I think ... because I need to put "." . manually, and I want to avoid this.
EDIT2
My friend also suggested that I could ignore. and, since the labels are always 100, 80, 32, etc. on editText just enter these numbers, but then treat them as double, and I would like to put a, 00, when the user finishes editing editText is this possible?
Is the comparison good if(et1.getText().toString().length() == 5 && et2.getText().toString().length() == 5){ while check wheter is edittext not empty? I have to update the TextView once when the edittext is not empty and do some operations, so I tried this way, is there another one better? (I put lenght () == 5, because in EditText I put maxlenght () = 5;
java android android-edittext
Stuart2041 May 23 '16 at 18:36 2016-05-23 18:36
source share