@Override
public void onClick(View view) {
AtimesB = nrB * nrA;
try {
AtimesB = Integer.parseInt(editA.getText().toString());
}catch(NumberFormatException e){
textInC.setText("Error!");
usableInt = false;
}
if(AtimesB == Integer.parseInt(editA.getText().toString())){
editA.setText("");
textC.setTextColor(Color.parseColor("#87d9ff"));
textC.append("CORECCT: " + nrB + " x " + nrA + " = " + AtimesB + "\n");
textInC.setText("");
nrA = rand.nextInt(50)+1;
nrB = rand.nextInt(50)+1;
textA.setText(String.valueOf(nrA));
textB.setText(String.valueOf(nrB));
}else if(usableInt = false){
textInC.setTextColor(Color.RED);
textInC.setText("Error");
}else{
textInC.setText("INCORECCT");
}
}
任何想法如何解決這個問題?當我點擊帶有空EditText的按鈕時,應用程序崩潰。空EditText Android崩潰
謝謝。
修復「什麼」?它是否是崩潰?你能發送日誌嗎?順便說一句,你有一個賦值而不是比較,'有趣的= false'缺少一個'='。 – EboMike 2011-02-25 23:18:45