当我在下面添加以下行时,我的应用停止工作:
Button chkCmd = (Button) findViewById(R.id.bResults);
ToggleButton passTog= (ToggleButton) findViewById(R.id.toggleButtonPass);
EditText input = (EditText) findViewById(R.id.etCommands);
TextView display = (EditText) findViewById(R.id.textViewResults);
但是当它消失了它
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.subject);
Button chkCmd = (Button) findViewById(R.id.bResults);
ToggleButton passTog= (ToggleButton) findViewById(R.id.toggleButtonPass);
EditText input = (EditText) findViewById(R.id.etCommands);
TextView display = (EditText) findViewById(R.id.textViewResults);
}
任何人都可以在上面看到问题
答案 0 :(得分:3)
EditText display = (EditText) findViewById(R.id.textViewResults);
或
TextView display = (TextView) findViewById(R.id.textViewResults);
您需要将显示更改为EditText,或将其转换为TextView