Hi All, i need some clarification on how this method should work, i'm working on an app that retrieves emails and displays them on a listview, I need to be able to update the UI as the emails are being retrieved and inserted into a Data Base, the information i'm inserting into the DB is not much, only the From email Address, Subject, time etc...
I was using the threading library but read a post from @Erel where he does not recommend using this library, so i updated my library so that i can use the Wait For method instead, this works great but i want to be able to display a progressdialog while the emails are being retrieved and the list View is being filled in, the problem is that i 'am not seeing the progressdialog at all, the emails are retrieved and the list view gets filled in but the app hangs while this process is happening, any advice, am I missing something?
Here is a piece of the code i 'am using, i'm using the Ultimate List View library and i'am using the latest version
As you guys can see i'am calling the progressDialogShow2 method, but the dialog is not showing at all, i've tried without the Sleep(0) lines before and after calling the progressdialogshow2 method and it doesn't work either.
Thanks all for the help.
Walter
I was using the threading library but read a post from @Erel where he does not recommend using this library, so i updated my library so that i can use the Wait For method instead, this works great but i want to be able to display a progressdialog while the emails are being retrieved and the list View is being filled in, the problem is that i 'am not seeing the progressdialog at all, the emails are retrieved and the list view gets filled in but the app hangs while this process is happening, any advice, am I missing something?
Here is a piece of the code i 'am using, i'm using the Ultimate List View library and i'am using the latest version
B4X:
Sub FillMailBox(cursor As Cursor)
Log("inside fillmailbox....")
Sleep(0)
ProgressDialogShow2("Retrieving Emails, please wait...", False)
Sleep(0)
dbcursor = Common.SQL1.ExecQuery("SELECT * FROM inbox WHERE emailAddress = " & "'"&Common.email&"'" & " AND mailIndex=1 ORDER BY UUID DESC")
mailList.ClearContent
mapItems.Clear
For i = 0 To dbcursor.RowCount - 1
Dim NewItem As typItemData
NewItem.Initialize
NewItem.Text = "item #: " & i
NewItem.Anim.Initialize(Me, "Anim_AnimationEnd")
Dim ID As Long = i
mapItems.Put(ID, NewItem)
mailList.AddItem("mail_retrieve", ID)
mailList.SetSwipeDirection(i, mailList.SWIPE_DIRECTION_BOTH)
Next
mailList.AnimationCleaner = True
ProgressDialogHide
End Sub
As you guys can see i'am calling the progressDialogShow2 method, but the dialog is not showing at all, i've tried without the Sleep(0) lines before and after calling the progressdialogshow2 method and it doesn't work either.
Thanks all for the help.
Walter