私が達成しようとしているのは、独自のレイアウトを含むダイアログの設定です。私のレイアウトは、4 つのラジオ ボタンを持つ単なるラジオグループです。私が抱えている問題は、DialogPreference.java ファイルのどのメソッドでラジオ ボタンを実際に使用できるかがわからないことです (つまり、どれが選択されているかを伝え、その値を共有設定に保存します)。現在私のDialogPreference。Java は次のようになります。
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
}
}
}
ダイアログが開くと、レイアウトが正しく表示されますが、ラジオ ボタンを使用するためのコードをどこに配置するかについて支援が必要です。