I'm new to Java, and I'm trying to make a simple calculator for waist and hip ratio. However the ratio has different rules for each gender.
My trouble is to link the radio button gender selection with the method with if statement. How can I do this? I have tried this code below, but it didn't work.
public class CalcActivity1 extends AppCompatActivity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_calc1);
    }
    public void btnCalcularOnClick(View v) {
        TextView resultado = (TextView) findViewById(R.id.lblResultado2);
        EditText txtquadril = (EditText) findViewById(R.id.txtquadril);
        EditText txtcintura = (EditText) findViewById(R.id.txtcintura);
        RadioGroup group = (RadioGroup) findViewById(R.id.radio_group);
        int quadril = Integer.parseInt(txtquadril.getText().toString());
        int cintura = Integer.parseInt(txtcintura.getText().toString());
        //CALC
        double rcq = cintura / quadril;
        int selectedId = group.getCheckedRadioButtonId();
        // I tried here to link them
        RadioButton RadioButton2 = (RadioButton) findViewById(selectedId);
        String chave = RadioButton2.getText().toString().toLowerCase();
        if (chave == "homem"){
            if(rcq <= 0.95){
                resultado.setText("Baixo");
            }
            else if(rcq > 0.96 & rcq <= 1){
                resultado.setText("Moderado");
            }
            else {
                resultado.setText("Alto");
            }
        }
        if (chave == "mulher"){
            if(rcq <= 0.80){
                resultado.setText("Baixo");
            }
            else if(rcq > 0.81 & rcq <= 0.85){
                resultado.setText("Moderado");
            }
            else {
                resultado.setText("Alto");
            }
        }
    }
}
 
     
    