Why does my application always crash whenever I try to change the text of an EditText? I have tried
celc = (EditText) findViewById(R.id.cel) ;
far = (EditText) findViewById(R.id.fa) ;
Ran = (EditText) findViewById(R.id.ran) ;
kelvin = (EditText) findViewById(R.id.kev) ;
celc.addTextChangedListener(new TextWatcher() {
@Override
public void onTextChanged(CharSequence s, int start, int before, int count) {
// TODO Auto-generated method stub
}
@Override
public void beforeTextChanged(CharSequence s, int start, int count,
int after) {
// TODO Auto-generated method stub
}
@Override
public void afterTextChanged(Editable s) {
// TODO Auto-generated method stub
String value = s.toString() ;
double c1 = Double.parseDouble(value) ;
double f1 = (32+((9.0/5)*c1));
double r1 = f1+460 ;
double k1 = c1 + 273.0 ;
far.setText(f1+"");
Ran.setText((r1 + ""));
kelvin.setText(k1+"");
}
}); but it doesn't work.