你没有设置 editSecond 你错误地设置了 editFirst 两次:editFirst = (EditText) findViewById(R.id.editfirst)editFirst = (EditText) findViewById(R.id.editsecond)//<-here you are setting editfirst instead of editSecond change it editSecond = (EditText) findViewById(R.id.editsecond)//<- change above line to this