当我尝试设置textview的文本时,我的应用程序会崩溃,不知道是什么原因?我该如何解决这个问题。
private TextView strStatus;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
txtUsername = (EditText) findViewById(R.id.username);
strStatus = (TextView) findViewById(R.id.status);
//strStatus.setText("test"); // SEEMS TO BE CAUSING THE CRASH
setContentView(R.layout.main);
}
<TextView
android:id="@+id/status"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
/>