Tag: getview

TextView为null

我遇到TextView问题。 按下按钮后,我想向TextView附加一些东西,但显然一直都是null。 fragment_one.xml …. …. ActivityTwo.java …. public void handleButtons(View v){ setContentView(R.layout.fragment_one); TextView tv = (TextView) v.findViewById(R.id.reply); if(v.getId() == R.id._0){ tv.append(“hi”); } …. 我想在reply TextView中添加一些文本,但显然,它一直返回NullPointerException。 我迷路了,我不知道什么是失败的。