I try to create currency format in my edittext.i searched and i wound code and i can add currency format in my edittext
transfer_maney.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence s, int start, int count, int after) {
}
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
if (!s.toString().equals(current)) {
transfer_maney.removeTextChangedListener(this);
String cleanString = s.toString().replaceAll("[$,.]", "");
double parsed = Double.parseDouble(cleanString);
String formatted = NumberFormat.getCurrencyInstance().format((parsed / 100));
current = formatted;
transfer_maney.setText(formatted);
transfer_maney.setSelection(formatted.length());
}
}
@Override
public void afterTextChanged(Editable s) {
}
})
now i want to disable/hide $ symbol inside input.it is a possible to hide/delete this symbol(i want this format without this symbol) if anyone knows solution please help me thanks everyone
Inside your Java code :
xml activity
/*this class already accept copy past values */
public class PayTextWatcher implements TextWatcher
The result is :