我无法从 DialogFragment 课程中收听 RadioGroup。我没有收到任何错误,但日志没有显示任何内容。请帮我...
public class SimpleDialog extends DialogFragment{
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
LayoutInflater inflater = getActivity().getLayoutInflater();
View view = inflater.inflate(R.layout.radio, null);
builder.setTitle(R.string.dialog_name)
.setView(inflater.inflate(R.layout.radio, null))
.setNegativeButton(R.string.cancel, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
}
});
RadioGroup radioGroup = (RadioGroup) view.findViewById(R.id.radioGroup);
radioGroup.setOnCheckedChangeListener(new OnCheckedChangeListener()
{
public void onCheckedChanged(RadioGroup group, int checkedId) {
Log.v("Dialog", "checked");
}
});
return builder.create();
}
}