**THE CODE**

For the checkout in my app, I let the user decide the payment method he wants to use by selecting it in a RadioButton Group:

```
        <RadioGroup
            android:id="@+id/payment_method"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            >

            <RadioButton
                android:id="@+id/radio_prepaid"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="prepaid"
                android:tag="prepaid"
                />

            <RadioButton
                android:id="@+id/radio_creditcard"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="creditcard"
                android:textAllCaps="true"
                android:tag="creditcard"
                />
        </RadioGroup>

```

From the user selection I want to show or hide the matching Layout:

```
    <RelativeLayout
    android:id="@+id/relativeLayout_card"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone"
    >
    ...
    </RelativeLayout>

```

or

```
<androidx.constraintlayout.widget.ConstraintLayout
    android:id="@+id/cL_preapid"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:visibility="gone"
    >
...
</ConstraintLayout>

```

I did it with this part of code:

```
    CompoundButton.OnCheckedChangeListener onPaymentChangedListener = (compoundButton,b) -> {

      if(compoundButton.getTag().equals("prepaid")) {
          relativeLayout_card.setVisibility(View.GONE);
          cl_prepaid.setVisibility(View.VISIBLE);

      }
      if(compoundButton.getTag().equals("creditcard")) {
          cl_prepaid.setVisibility(View.GONE);
          relativeLayout_card.setVisibility(View.VISIBLE);
      }

    };

    rb_creditcard.setOnCheckedChangeListener(onPaymentChangedListener);
    rb_prepaid.setOnCheckedChangeListener(onPaymentChangedListener);

```

**THE PROBLEM**

**1. CLICK** on my Prepaid / CreditCard RadioButton it shows the matching view perfectly

**2. CLICK** on my Prepaid / CreditCard RadioButton it does simply nothing

**3. CLICK** on my Prepaid / CreditCard RadioButton it reverses the views: "prepaid" shows the CreditCard Layout, "creditcard" shows me PrepaidPay Layout

Is this a problem with the Layouts (should I implement a ViewSwwichter / ViewPager) or is there an error in my code?

Thank you