You can quite easy do this. I have a sqlite sync routine (using jtds/jdbc to sql server).
And when I start a sync, I display the "indetermine" progress bar (and I HIGH recommend you do this). In ohter words, I would not wait 3 seconds.
The only real issue then is do you want some progress notification WHILE you filling out the xcustomListview, but you HAVE the data. You can do this, since you do now have a row count from the query (once it done). But lets deal with the first part.
You could/would simply use a timer.
thus you do this:
ProgressBar1.Visible = True
MyTimer.Initialize("TShow",3000)
MyTimer.Enabled = True
' My sql query with wait for goes here.
' after sql query is done, we turn off the timer like this:
MyTimer.Enabled = False
ProgressBar1.Visible = False
EditText1.Visible = False
'' and our message display event on "tick" would be this:
Sub Tshow_Tick
' ok 3 seconds - show the progress text or message wait buton
'ToastMessageShow("3 seconds - waiting",True)
EditText1.Text = "Loading data - please wait"
EditText1.Visible = True
MyTimer.Enabled = false ' no need to have this code fire every 3 seconds.
End Sub
Now in above, I commented out the toastmessage - but you could fire one of those - pulling data please wait!
(I like them, as they don't take up UI space - and they just fade in/ then out).
But, regardless, the Tick event only fires after 3 seconds, and then displays our message (hidden text box in this example).
but, if the whole operation occurs in less then 3 seconds, then our code that follows the query + wait for turns off the timer, and that 3 second message of course never displays.
As noted, I tended to always display the spinning circle during the sync process (that's the indeterminate progress bar). As for a progress bar? As noted, you could start/show/display one AFTER the query, since often the xCustomList view load up time is RATHER expensive and time consuming (much more then the query pull). And you do have the row count at that point in time . But then again, this assumes and suggests we keep the CLV down to 100 max range.
Larger lists suggests a different UI to reduce the amount of scrolling required to deal with 100+ rows.
So, I can't see much need for the CLV loading time, since if it too large and a noticeable wait time exists, then we already messed up and are overloading the users ability to work with 100 rows of data anyway.
Regards,
Albert D. Kallal
Edmonton, Alberta Canada