我是在button的onclick里写的用的swith,一按按钮就崩溃,后来捕捉错误为
Attempt to invoke virtual method 'android.text.Editable android.widget.EditText.getText()' on a null object reference
但是我et应该有值啊,不理解
case R.id.next:
EditText et = (EditText) v.findViewById(R.id.number);
try {
System.out.println(et.getText().toString());//这句话报错
} catch (Exception ex) {
System.out.println("Error :" + ex.getMessage());
}
break;