Hello,
My program is crashing or locked somewhere, and there's no error reported in the IDE. The full code is below.
Using the IDE designer, I added a label called lblStory, whose text I want to change from another thread. In this new thread, called PlayWav, I change the label's text with a for loop. The for loop rarely reaches the end; it stops after a certain random number of iterations. I'm testing on Samsung Galaxy Win.
What could be happening?
My program is crashing or locked somewhere, and there's no error reported in the IDE. The full code is below.
Using the IDE designer, I added a label called lblStory, whose text I want to change from another thread. In this new thread, called PlayWav, I change the label's text with a for loop. The for loop rarely reaches the end; it stops after a certain random number of iterations. I'm testing on Samsung Galaxy Win.
What could be happening?
B4X:
#Region Project Attributes
#ApplicationLabel: Example
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: landscape
#CanInstallToExternalStorage: False
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#End Region
Sub Process_Globals
End Sub
Sub Globals
Dim PlayThread As Thread
Private lblStory As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("1")
lblStory.Text = "0"
lblStory.Invalidate
PlayThread.Initialise("PlayWav")
PlayThread.Start(Null, "PlayWav", Null)
End Sub
Sub PlayWav()
Dim i As Int
For i = 1 To 1000
lblStory.Text = i
'lblStory.Invalidate
'PlayThread.sleep(10)
Next
Log("Made it")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub