我希望在非Preference Activity中显示ListPreference对话框。
这是创建对话框的代码:
// this is my current activity
ListPreference listPreference = new ListPreference(this);
listPreference.setDialogIcon(R.drawable.auto_download);
listPreference.setTitle(R.string.autoDownloadTitle);
listPreference.setEntries(R.array.autoDownloadEntries);
listPreference.setEntryValues(R.array.autoDownloadValues);
listPreference.setNegativeButtonText(R.string.cancel);
Dialog dialog = listPreference.getDialog();
我的问题是对话框始终为空,我错过了什么吗?