我不断收到空指针错误,但我不知道为什么。有什么非常明显的我想念的吗?
final Dialog d = new Dialog(Start.this);
// dialog.requestWindowFeature((int) Window.FEATURE_NO_TITLE);
d.requestWindowFeature((int) android.view.Window.FEATURE_NO_TITLE);
d.setContentView(R.layout.popuptwo);
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
lp.copyFrom(d.getWindow().getAttributes());
lp.width = WindowManager.LayoutParams.MATCH_PARENT;
lp.height = WindowManager.LayoutParams.MATCH_PARENT;
d.show();
d.getWindow().setAttributes(lp);
TextView totaltxt = (TextView) findViewById(R.id.totaltxt);
totaltxt.setText("Test text");
如果我删除totaltxt.setText("Test text");
,那么程序不会崩溃。想法?