Android 小项目之--猜名字有奖
2010-06-01 15:34:00 来源:WEB开发网030
031mButton.setOnClickListener(new OnClickListener() {
032
033@Override
034public void onClick(View v) {
035// TODO Auto-generated method stub
036if(mRadioButton1.isChecked())
037{
038mRadioButton1.setChecked(false);
039}
040if(mRadioButton2.isChecked())
041{
042mRadioButton2.setChecked(false);
043}
044if(mRadioButton3.isChecked())
045{
046mRadioButton3.setChecked(false);
047}
048if(mRadioButton4.isChecked())
049{
050mRadioButton4.setChecked(false);
051}
052
053}
054});
055
056list=new OnCheckedChangeListener() {
057
058@Override
059public void onCheckedChanged(RadioGroup group, int checkedId) {
060// TODO Auto-generated method stub
061RadioButton btn=(RadioButton)findViewById(checkedId);
062if(btn.isChecked())
063{
064switch (checkedId) {
065case R.id.RadioButton01:
066
067
068Show("回答邋锗!");
069
070break;
071case R.id.RadioButton02:
072
073Show("回答邋锗!");
074
075break;
076case R.id.RadioButton03:
077
078Show("回答正催,??你100分");
079
080break;
081case R.id.RadioButton04:
082
083Show("回答邋锗!");
084
085break;
086
087}
088}
089
090}
091};
092
093mGroup.setOnCheckedChangeListener(list);
094}
095
096public void Show(String msg)
097{
098new AlertDialog.Builder(TestRadioButton.this)
更多精彩
赞助商链接