0

私が達成しようとしているのは、独自のレイアウトを含むダイアログの設定です。私のレイアウトは、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
    }
}
}

ダイアログが開くと、レイアウトが正しく表示されますが、ラジオ ボタンを使用するためのコードをどこに配置するかについて支援が必要です。

4

1 に答える 1

0

RadioGroup の作品を入れる @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 } }

于 2014-02-12T02:10:23.277 に答える