【发布时间】:2012-03-22 17:30:44
【问题描述】:
我有下面的 alertdialog 代码:
AlertDialog.Builder helpBuilder = new AlertDialog.Builder(this);
helpBuilder.setTitle("Options");
helpBuilder.setMessage("Choose Your Option");
LayoutInflater inflater = getLayoutInflater();
View radioButtonLayout = inflater.inflate(R.layout.popuplayout, null);
byNameRadioButton = (RadioButton) findViewById(R.id.byname);
byIdRadioButton = (RadioButton) findViewById(R.id.byid);
helpBuilder.setView(radioButtonLayout);
helpBuilder.setPositiveButton("Ok",
new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(Tab1Activity.this,
"Ok button is clicked", Toast.LENGTH_LONG)
.show();
}
}
});
AlertDialog helpDialog = helpBuilder.create();
helpDialog.show();
我想知道单击确定按钮时单击了哪个单选按钮?? 需要帮助。 谢谢!
【问题讨论】:
标签: android radio-button android-alertdialog