我有一个小问题,你们能帮帮我吗?
我有这样的代码:
TextView tz;
TextView tv = new TextView(this);
tv.setId(0x7f090024);
tv.setText("hello");
View vv = findViewById(0x7f090024);
if (vv != null)
{
Log.e("number_id", "not null");
}
else
Log.e("number_id", "null");
// also return error (java lang null pointer exception) with this
tz = (TextView) findViewById(0x7f090024);
Log.e("test", tz.getText().toString());
为什么这个结果总是返回null
并且我无法从第二个文本字段中获取值tz
?