Android Question [Solved] B4XLoadingIndicator: Sleep not resumed (context is paused)

asales

Expert
Licensed User
Longtime User
When I close the activity that uses B4XLoadingIndicator
(https://www.b4x.com/android/forum/threads/b4x-xui-b4xloadingindicator-loading-indicator.92243/)
I get this message:
B4X:
Sleep not resumed (context is paused): b4a.example3.b4xloadingindicator$ResumableSub_MainLoop

The sub MainLoop is:
B4X:
Private Sub MainLoop
   index = index + 1
   Dim MyIndex As Int = index
   Dim n As Long = DateTime.Now
   Do While MyIndex = index
       Dim progress As Float = (DateTime.Now - n) / duration
       progress = progress - Floor(progress)
       cvs.ClearRect(cvs.TargetRect)
       CallSub2(Me, DrawingSubName, progress)   
       cvs.Invalidate
       Sleep(10)
   Loop
End Sub
This message is a problem? I need to worry about this? If yes, what I need to change in the code?

Thanks in advance to any help.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is not a problem. It means that the sleep call was not resumed because the activity was paused. This is good as you don't want this loop to continue to run while the app is in the background.

Make sure to include this code in the activity:
B4X:
Sub Activity_Resume
   For Each v As View In Activity.GetAllViewsRecursive
       If v.Tag Is B4XLoadingIndicator And v.Visible = True Then
           Dim x As B4XLoadingIndicator = v.Tag
           x.Show
       End If
   Next
End Sub

The purpose of this code is to start the loop again.
 
Upvote 0
Top