I have read a lot in the forum about ResumableSubs, Threads, AsyncTasks but i still dont get it, or dont know what i need.
My goal:
Open a custom dialog with layout that has a preview image and a empty combobox, then when layout loads, fill combobox in a background while the user sees preview image, then when sub finishes enable the combobox and a button in the layout.
What currently have:
Load the layout for custom dialog
load the preview image
show the custom dialog
call the sub i want to load in background
UI and App lags until the sub is finished loading data and filling the combobox then shows Dialog
Sub that loads the combobox list is called from a Code module:
Which is the best way to load a sub in Background after layout is loaded?
Im very confused
My goal:
Open a custom dialog with layout that has a preview image and a empty combobox, then when layout loads, fill combobox in a background while the user sees preview image, then when sub finishes enable the combobox and a button in the layout.
What currently have:
Load the layout for custom dialog
load the preview image
show the custom dialog
call the sub i want to load in background
UI and App lags until the sub is finished loading data and filling the combobox then shows Dialog
Sub that loads the combobox list is called from a Code module:
B4X:
Sub ListAvailStickerPacksNames(Module As Object) As ResumableSub '<----Tried resumable sub expectin background task but same results
Dim SPS As List=Starter.sc.getAllStickerPacks '<-----READS AND Return a LIST FROM OWN LIBRARY, IT READS VERY FAST
Dim AvailableSPS As List
AvailableSPS.Initialize
For Each SP In SPS
If Starter.sc.isAnimated(SP) = True Then
If Starter.sc.getAllStickers(SP).Size < 30 Then
AvailableSPS.Add(Starter.sc.GetStickerPackName(SP))
End If
End If
Next
CallSub2(Module,"SetComboBoxNames", AvailableSPS)
'Return AvailableSPS
End Sub
Which is the best way to load a sub in Background after layout is loaded?
Im very confused
Last edited: