单击“确定”按钮时,如何从选定的RadioButton获取值?我单击确定按钮时想要工作RadioButton功能。 NOT isChecked()函数。这是我的Custom RadioButton对话代码。
txt_language.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final Dialog dialog = new Dialog(context);
dialog.setContentView(R.layout.custom_language_dialog);
tha = (RadioButton) dialog.findViewById(R.id.tha);
en = (RadioButton) dialog.findViewById(R.id.en);
btnOK = (Button) dialog.findViewById(R.id.btn_ok);
if (tha.isChecked()) {
StoreUtil.getInstance().saveTo("languages", "tha");
closeAllActivities();
}
if (en.isChecked()) {
StoreUtil.getInstance().saveTo("languages", "en");
closeAllActivities();
}
// btnOK.setOnClickListener(this);
dialog.show();
}
});
答案 0 :(得分:0)
经过测试和工作。查看this
users[i]
XML
testdata[i]
有关详细信息,请访问:Android getting value from selected radiobutton
number of items to replace is not a multiple of replacement length