I have a progress animation (using LoadingIndicatorView) that is running inside a thread. I call this animation when i start to update my SQLITE db. When downloading all the needed files (using httpok), the animation is running properly but when i start to insert the downloaded data inside my sqlite (records can be around 1000 to 2000), the animation freezes (the sub is still executed as i have placed logs inside the sub). I already tried using doevents but it has no effect, what can i do or implement to fix this issue?
Here is the thread i declared inside Globals:
HEre is the test_thread sub (In that code i made a boolean flag that exits the sub when it is true. If not i display the progressbar):
this is the sub for updateing the text inside the panel of the progressbar:
I use this code inside a sub to update my SQLite db and call the progress animation:
I used the same loop to process 3 types of data so i use them around 3 times for the entirety of the program.
Here is the thread i declared inside Globals:
B4X:
Dim ThreadTest As Thread
ThreadTest.Initialise("TT")
ThreadTest.Start(Me,"test_thread",Null)
Private np1 As NumberProgressBar
HEre is the test_thread sub (In that code i made a boolean flag that exits the sub when it is true. If not i display the progressbar):
B4X:
Sub test_thread
If bitStopThread Then
Return
Else
pnlProgress.BringToFront
showProgress(True)
End If
End Sub
this is the sub for updateing the text inside the panel of the progressbar:
B4X:
Sub thread_progress(str As String)
If bitStopProgress Then
Return
Else
pnlProgBar.BringToFront
showProgBar(True)
lblProgBar.Text = str
If np1.Progress <= 30 Then
np1.incrementProgressBy(1)
End If
DoEvents
End If
End Sub
I use this code inside a sub to update my SQLite db and call the progress animation:
B4X:
For intA = 0 To upInfo.Length - 1
If upInfo(intA).Length > 0 Then
Dim myInfo() As String = Regex.Split("~",upInfo(intA))
thread_progress( "Updating Quizzes....")
intRec = Starter.s.ExecQuerySingleResult("select exm_id from tbl_exam where exm_id = " & myInfo(15) )
If intRec = Null Then
bitUpdate = True
Starter.s.AddNonQueryToBatch("insert into tbl_exam (exp_id,sbj_id,mode_,info_,picture_,answer_,a_,pic_a,b_,pic_b,c_,pic_c,d_,pic_d,e_,pic_e,rationale_,exm_id,exm_free ) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", _
Array As Object(myInfo(16),myInfo(18),myInfo(0),myInfo(1),myInfo(2),myInfo(3),myInfo(4),myInfo(5),myInfo(6),myInfo(7),myInfo(8),myInfo(9),myInfo(10),myInfo(11),myInfo(12),myInfo(13),myInfo(14),myInfo(15),myInfo(20) ))
End If
End If
Next
Starter.s.ExecNonQueryBatch("SQL1")
I used the same loop to process 3 types of data so i use them around 3 times for the entirety of the program.