I have a dialog preference with a custom layout, and the custom layout has 4 radio buttons. I have a DialogPreference.java file where the layout is set fine by
setDialogLayoutResource(R.xml.imagechoice);
and what I would like to do is reference the radio buttons and persist a boolean from which is checked. The problem I have is how to make a reference to the radio buttons because this DialogPreference file doesn't extend activity but dialog preference. What I tried is this:
public DialogPreferences(Context oContext, AttributeSet attrs)
{
super(oContext, attrs);
setDialogLayoutResource(R.xml.imagechoice);
//group = (RadioGroup) findViewById(R.id.group1);
LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater();
View view = inflater.inflate(R.xml.imagechoice, null);
group = (RadioGroup)view.findViewById(R.id.radiogroup);
}
and it never is able to find the id of any of my radio buttons or the radio group. I would like some assistance as to if this is the correct method to try this in, or if there is a different way to accomplish what I am trying to do.