Hi Masters, is there any way how to show a progress dialog while running a sql query then hides it upon complete. i try to use a timer to delay and show the progressdialog while running a query and hides it. my problem is before completing the query the progress dialogs hangs then hide. I have a sql database that has 35700 rows. What is the proper way to do it without hang. Hope someone can help. Tnx
ProgressDialogShow("Stand by. Lots of records")
For i=0 To Cursor1.RowCount-1
Cursor1.Position=i
MyListView.add(…..' or whatever you want to do
If i Mod 100 = 0 Then DoEvents 'the 100 can be changed
Next
ProgressDialogHide
that's the ideal way to solve slow stuff like that but we don't know if he's just filling a listview or is doing some other stuff that could be improved.
Adding a progressdialog on query is for formal presentation than the program is running a query and if i not use a progressdialog then the android just hang nothing to display until it finishes the query. hope you understand.
Adding a progressdialog on query is for formal presentation than the program is running a query and if i not use a progressdialog then the android just hang nothing to display until it finishes the query. hope you understand.
If you are doing a SELECT and it's taking so long that you require a progress dialog for the query then you are quite probably doing something wrong. Selecting 35700 rows into a cursor just doesn't take that long unless you are doing something really really complex with multiple sub queries?
If the query is taking that long you should show your dialog then use ExecQueryAsync to run your query off the main thread and then hide the dialog when the QueryComplete event is called.
I agree with @keirS. You should use ExecQueryAsync. However you should also think carefully if such a large query is required at all. Showing 37k rows to a user is way to much.