I have an apk to load payments, where transfer details are attached. Among several options there is a field where an amount with decimals is entered. When trying to edit the amount, it shows this error and returns me to the previous screen.
code
}
iv6.setVisibility(View.VISIBLE);
etvalor.setText(min);
s = Float.parseFloat(min);
Float Bsf = Float.parseFloat(tasa)*s;
//Toast.makeText(getApplicationContext(), tasa.toString(), Toast.LENGTH_LONG).show();
Locale currentLocale = Locale.GERMAN;
otherSymbols = new DecimalFormatSymbols(currentLocale);
otherSymbols.setDecimalSeparator(',');
otherSymbols.setGroupingSeparator('.');
df = new DecimalFormat("#,##0.00", otherSymbols);
String numberAsString = df.format(Bsf);
etBsf.setText(numberAsString);
etBsfpromo.setText(numberAsString);
String tasaAsString = df.format(Float.parseFloat(tasa));
tvTasa.setText(tasaAsString);
final String finalTasa = tasa;
etvalor.addTextChangedListener(new TextWatcher() {
public void onTextChanged(CharSequence s, int start, int before,
int count) {
if(!s.equals("") ) {
//do your work here
}
}
I will add more text that might be of interest.
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
}
public void afterTextChanged(Editable s) {
Float w = null;
if(checkboxpromo.isChecked()){
w = Float.parseFloat(String.valueOf(etvalor))*(1+(Float.parseFloat(valorp.get(spinnerpromo.getSelectedItemPosition()))/100));
valorpromo = valorp.get(spinnerpromo.getSelectedItemPosition());
}else {
w = Float.parseFloat(String.valueOf(etvalor));
valorpromo="0";
}
Float w1 = Float.parseFloat(finalTasa)*w;
String numberAsString3 = df.format(w1);
etBsf.setText(numberAsString3);
etBsfpromo.setText(numberAsString3);
}
});
I appreciate any input!