Android(活动不工作需要帮助初学者)

时间:2014-01-15 20:37:47

标签: java android xml

当我在下面添加以下行时,我的应用停止工作:

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);
}

任何人都可以在上面看到问题

1 个答案:

答案 0 :(得分:3)

EditText display = (EditText) findViewById(R.id.textViewResults);

TextView display = (TextView) findViewById(R.id.textViewResults);

您需要将显示更改为EditText,或将其转换为TextView