@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