I have a Sub in a module. that checks if the connection to the internet ..
B4X:
If T.DataConnection = False Then
T.TurnDataConnectionOn 'Enables Conexao Data GPRS / EDGE / HSPA
Error = False
While the T.DataConnection = False
A = (DateTime.Now - HoraIncio) / (DateTime.TicksPerSecond)
Status_Conexao = "Enabling Connection Provider (" & Num & ")"
If Num> = TimeOut Then
Error = True
Exit
end If
DoEvents
Loop
I call this a sub ACTIVY .. I need to capture the value of the variable Status_Conexao and play within a label such as ACTIVY do it?
It seems you'd better execute this code in a service (background task). Within the service (within your loop) you can call a method in your activity that updates the label by using CallsubDelayed2.
Be careful: code executed in a class is part of the thread in which the class is being used, just as all other code.
So: if you create a class in the activity code, all methods of the class executed are running in the thread of the activity. And as was confirmed by Erel: you should not execute long running code in an activity.