In the program, I have two random values (loadG4 and rbvalue). These values are set to 4 buttons, rbvalue to 3 and loadg4 to one (loadg4 overrides on of the rbvalue buttons). Th
The issue is that you are creating the loadG4 variable in multiple places with different scopes. When you do this :
final int loadG4 = GenerateG4.nextInt(10);
You are creating a new variable G4 which exists separately from your instance variable loafG4 which was created first (and never changes ). Hence, you are always comparing against a constant value.
Also, you are changing the value of the button text inside onClickListener, that is why your button labels keep changing on pressing them.