Sub rb_CheckedChange(Checked As Boolean) 'new sub
For Each rb As RadioButton In pnlRadioButton.GetAllViewsRecursive
If GoodAnswer = rb.Tag Then
SetColorTintList(rb,Colors.Green,Colors.Green,Colors.Gray)
Else
SetColorTintList(rb,Colors.Red,Colors.Red,Colors.Gray)
End If
Next
End Sub
Private Sub reset_radiobutton
rb1.Checked = False
rb2.Checked = False
rb3.Checked = False
For Each rb As RadioButton In pnlRadioButton.GetAllViewsRecursive
SetColorTintList(rb,Colors.Gray,Colors.Gray,Colors.Gray)
Next
End Sub
Sub SetColorTintList(RB As RadioButton,Checked As Int,Enabled As Int,Disabled As Int)
Dim States(3,1) As Int
States(0,0) = 16842912 'Checked
States(1,0) = 16842910 'Enabled
States(2,0) = -16842910 'Disabled
Dim Color(3) As Int = Array As Int(Checked,Enabled,Disabled)
Dim CSL As JavaObject
CSL.InitializeNewInstance("android.content.res.ColorStateList",Array As Object(States,Color))
Dim CB1 As JavaObject = RB
CB1.RunMethod("setButtonTintList",Array As Object(CSL))
End Sub