Android Question Deal with big data

chrjak

Active Member
Licensed User
Longtime User
Hey Community,

I have a problem. There is a 'ShowValues' activity, that loads many numbers and shows them in labels. (No that process can't be improved) That loading takes a long time so i want to show a moving progressdialog to the user. But the first problem I had was that I called Progressdialogshow before the for next loop and progressdialoghide after the 'next' command. That only opened the progressdialog at the end of the loading process for about a half second. Now I fixed it that way:

B4X:
Startactivity:

Sub OpenValues
CallSubDelayed(ShowValues, "showloading")
End Sub

ShowValues Module:

Sub Activity_Create
Activity.LoadLayout("Layout")
ProgressDialogShow("Loading")
End sub

Sub showloading
    CallSubDelayed("", "Calculate")
End Sub

Sub Calculate
'Calculating Process & For/Next Loop
Progressdialoghide
End sub
But the problem was now that the progressdialog was lagging. The dialog field was shown but the progressbar didn't move/wasn't even shown because of lagging.


I already tried taking the loop out and calling the sub (Callsubdelayed("", Calculate)) after calculating one value again and again till everything is calculated. But that didn't update the progressdialog so that the progressbar moves. it's still lagging...

Could you please help me?
 

chrjak

Active Member
Licensed User
Longtime User
Thats awesome *.*

But it's a lot slower right!? When i was testing without doevents the loading process took ~ 20 secs and with the doevents >10min....
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
Additionally it doesn't work when you try to update the progressdialog text before the doevents in the loop, right? (e.g. to show a progress - "12/90000 done")
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
before the next
eg.

'Progressdialog
for i = 0 to list.size -1
'Calculate
Doevents
next
 
Upvote 0

chrjak

Active Member
Licensed User
Longtime User
I made some tests and with that mod 1000 the calculating process is 5 seconds faster then the standard one
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…