hi all
i have this code and i would like to select a random question from the list and then press the button (Bnext_Click) to move to the next random question but it has to remeber the questions that had passed
my code is below
how do i do the random selection and how do i make it remember wich question it passed?
i have this code and i would like to select a random question from the list and then press the button (Bnext_Click) to move to the next random question but it has to remeber the questions that had passed
my code is below
how do i do the random selection and how do i make it remember wich question it passed?
B4X:
Sub LoadQuizQuestion
Dim jobadd As HttpJob
jobadd.Initialize("quizquestion", Me)
jobadd.Download("http://www.mydomain.com/quizq.php")
ProgressDialogShow("Downloading")
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Dim strReturn As String = Job.GetString
Dim parser As JSONParser
parser.Initialize(strReturn)
If Job.JobName = "quizquestion" Then
Dim quizlist As List
quizlist = parser.NextArray 'returns a list with maps
For i = 0 To quizlist.Size - 1
Dim m As Map
m = quizlist.Get(i)
Dim TL As quizpar 'TwoLines
TL.First = m.Get("quizquestion")
TL.Second = m.Get("quizanswer1")
TL.third=m.Get ("quizanswer2")
TL.forth=m.Get ("quizanswer3")
TL.five=m.Get("quizanswer4")
TL.six=m.Get("quizanswer5")
Label1.Text= TL.First
Button1.Text=TL.Second
Button2.Text=TL.third
Button3.Text=TL.forth
Button4.Text=TL.five
LcorectAsw.text=TL.six
Exit
Next
Else If Job.JobName = "LogOut" Then
Dim act As String = parser.NextValue
If act = "LoggedOut" Then
ToastMessageShow("Logout successful", True)
StartActivity(Main)
Activity.Finish
End If
Else
ToastMessageShow("Error: Invalid Value", True)
End If
Else
'Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Sub Bnext_Click
LoadQuizQuestion
End Sub