The following code I used to replace .(dot) by ,(coma) while user inputing value to edit text
InputFilter[] FilterArray = new InputFilter[1];
FilterArray[0] = new InputFilter(){
@Override
public CharSequence filter(CharSequence arg0, int arg1, int arg2,
Spanned arg3, int arg4, int arg5) {
String temp =arg0.toString();
temp=temp.replace('.',',');
return temp;
}
};
etxt_kg.setFilters(FilterArray);
The above code successfully interprets user each inputs. but it replaces nothing for .(dot)
Now : input: 12.45 Output: 1245
What i want: input 12.45 output: 12,45
Any help( TIA)
EDIT:
problem was in xml.. EditText inputType=”number” .
I faced same scenario.Here is a solution
Use following Snippet
Below is my working snippet