我想完成的是我有自己的布局的对话框首选项。我的布局只是一个带有4个单选按钮的radiogroup。我遇到的问题是我不确定我的DialogPreference.java文件的哪个方法实际上可以用单选按钮进行操作(意思是告诉哪一个被选中,然后将该值保存到共享首选项中)。目前我的DialogPreference。 java的样子:RadioGroup的自定义对话框首选项
public class DialogPreferences extends DialogPreference implements RadioGroup.OnCheckedChangeListener
{
RadioGroup group;
public DialogPreferences(Context oContext, AttributeSet attrs)
{
super(oContext, attrs);
setDialogLayoutResource(R.xml.imagechoice);
}
@Override
public void onCheckedChanged(RadioGroup radioGroup, int checkedId) {
//I would like to do things here but when I try to for example add the reference to a radio button it gives cannot resolve method findViewById error
}
}
}
当对话框打开,它显示的布局正确,但我只需要援助的地方把代码利用单选按钮。
工作尝试张贴您正在尝试的代码,它提供了错误。在这种情况下,[MCVE](http://stackoverflow.com/help/mcve)可能也有帮助。 –