findViewByid一定要放在setContentView(R.layout.a..)之后

findViewByid一定要放在setContentView(R.layout.a..)之后
否则还没布局,根本找不到这些控件
setContentView(R.layout.activity_input);

editText0 = (EditText) findViewById(R.id.sample_edit_text0);
buttonCheck = (Button) findViewById(R.id.sample_buttonCheck);
buttonExit= (Button) findViewById(R.id.sample_buttonExit);
posted @ 2018-05-25 19:07  strongdady  阅读(246)  评论(0编辑  收藏  举报