爲什麼每當我嘗試更改EditText的文本時,我的應用程序總是崩潰?我試過 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(新TextWatcher(){設置EditText的文本時應用程序崩潰
@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.
如何赫克是我們應該知道既不代碼不具有堆棧跟蹤?所以我會和「gremlins做到這一點」一起去。 –
請提供一個[最簡單,完整且可驗證的示例](http://stackoverflow.com/help/mcve)來展示您的問題。在這種情況下,請發佈[與您的崩潰相關的Java堆棧跟蹤](https://stackoverflow.com/questions/23353173/uncomfort-myapp-has-stopped-how-can-i-solve-this),以及堆棧跟蹤中引用的代碼。 – CommonsWare
把你的logcat錯誤。 –