在oncreate中使用findViewById 时要将findViewById 放在setContentView()之后
因为当调用该函数之后才会绘制当前的layout,之前的layout成员都是不存在的,所以要将findViewById 的调用放在setContentView()之后
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_other);
tv = (TextView)Other.this.findViewById(R.id.text_other);
if(tv != null){
Intent it = getIntent();
tv.setText(it.getStringExtra("enter") + ",终于出来了," + it.getStringExtra("mystring"));
}
}