Hi, It's me again. Follow up question to my old thread about Quiz App. This is the scenario. At the end of the exam (Result Layout). The user have an option to Retry or Review the Exam. In the Review module, I have generated buttons depending on the Number of Questions. Now let's say the app generated 5 buttons. My question is how can I change the color of the buttons if the user in Correct or Wrong on that specific question. Let's say that the user is correct in Question #1 (Button 1) then the color will be green and then if the user is wrong it will be color red. Here is my Code on how I generate buttons:
I have attached a example video of my current app process here:
B4X:
Sub Activity_Resume
drawButtons
setButtons(items)
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub drawButtons
btns.Clear
Dim pad As Int = 4dip
Dim x As Int = pad
Dim y As Int = pad
Dim w As Int = (ScrollView1.Width - 5 * pad) / 3
Dim h As Int = (ScrollView1.Height - 6 * pad) / 3
For i = 0 To 60 - 1
Dim btn As Button
btn.Initialize("btn")
ScrollView1.Panel.AddView(btn, x, y, w, h)
btn.Textsize = 40
btn.TextColor = xui.Color_White
btn.Color = xui.Color_Blue
x = x + w + pad
If ((i Mod 3) = 2) Then
x = pad
y = y + pad + h
End If
btn.Tag = i
btns.Add(btn)
Next
End Sub
Sub setButtons(data As List)
Dim i As Int = 0
Do While (i < btns.size)
Dim b As Button
b = btns.Get(i)
If (i < items.Size) Then
b.Text = data.Get(i)
Else
b.Text = ""
End If
i = i + 1
Loop
End Sub
I have attached a example video of my current app process here: