I am working on a unit converter app. It gets value from EditText and multiply it with values from string array and again stores in another array. Then displays it in ListView. But the EditText textwatcher is working slow. Why?
etarea.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 (etarea.getText().length() > 0){
double b = Double.parseDouble(etarea.getText().toString());
for(int i = 0; i <= valueSpinner.length -1; i++){
double a = Double.parseDouble(valueSpinner[i].toString());
double c = b*a;
DecimalFormat df = new DecimalFormat(decimal);
valueet[i] = df.format(c);
}
viewHolder.tvvalue.setText(valueet[i]);
tvareavalue.setText(valueet[posonclick]);
}else{
viewHolder.tvvalue.setText("Enter Value");
}
}
@Override
public void afterTextChanged(Editable s) {
}
});