我的首选项活动中有一个对话框,定义如下(布局在 xml 中定义):
public class DialogPreference extends android.preference.DialogPreference {
public DialogPreference(Context context, AttributeSet attrs) {
super(context, attrs);
}
public DialogPreference(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
}
public void onClick (DialogInterface dialog, int which) {
if (DialogInterface.BUTTON_POSITIVE == which) {
if (getKey() ==
getContext().getResources().getText(R.string.blabla)) {
// FIXME ??? - how ?
Log.v(TAG, "DialogPreference: onClick");
}
}
}
}
在对话框中有几个小部件,即 aRadioGroup
和几个RadioButton
s。我目前无法在该方法中找到访问这些小部件的onClick
方法。
访问这些小部件的方法是什么?