@Override
protected Dialog onCreateDialog(int id) {
Dialog dialog = null;
switch(id) {
case DIALOG_ID:
LayoutInflater inflater = getLayoutInflater();
View InfoLayout = inflater.inflate(R.layout.info_dialog, null);
AlertDialog.Builder b = new AlertDialog.Builder(MyActivity.this)
.setView(InfoLayout );
initInfoDialog(dialog);
return dialog;
...
private void initInfoDialog(Dialog dialog) {
//this line has the null pointer
WindowManager.LayoutParams lp = dialog.getWindow().getAttributes();
为什么dialog.getWindow()在这种情况下返回null?