Android RadioButton IsSelected不工作

Android RadioButton IsSelected不工作,android,Android,我有一个无线组,有两个按钮,分别是黑色和彩色。当我尝试根据选择进行计算时,什么都没有发生。你知道为什么我的单选按钮坏了吗?谢谢 public void onClick(View v) { // TODO Auto-generated method stub EditText startingAmt = (EditText) findViewById(R.id.editText1);

我有一个无线组,有两个按钮,分别是黑色和彩色。当我尝试根据选择进行计算时,什么都没有发生。你知道为什么我的单选按钮坏了吗?谢谢

                public void onClick(View v) {
                // TODO Auto-generated method stub
                EditText startingAmt = (EditText) findViewById(R.id.editText1);
                RadioButton black = (RadioButton) findViewById(R.id.radio0);
                RadioButton color = (RadioButton) findViewById(R.id.radio1);
                if(!TextUtils.isEmpty(startingAmt.getText().toString().trim())){


                TextView ***** = (TextView)findViewById(R.id.textView1);
                double  temp1 = 0.0,
                        endAmt = 0.0,
                        startAmt = 0.0;
                String answer;
                Editable editableValue1 = startingAmt.getText();
                startAmt = Double.parseDouble(editableValue1.toString());
                if(color.isSelected()){
                    temp1 = startAmt * 1.15;
                    endAmt = temp1 * .15;
                    endAmt = (double)Math.round(endAmt*10)/10;
                }
                if(black.isSelected()){
                    temp1 = startAmt * 1.10;
                    endAmt = temp1 * .10;
                    endAmt = (double)Math.round(endAmt*10)/10;
                }

使用此方法,而不是选择
is
。或者,您可以在包含两个
单选按钮的
放射组上使用,而不是使用
isSelected()
转到
isChecked()

谢谢!我假设它被选中了lol你选中一个复选框并选择一个单选按钮!