Android Question Function running time in timer is too long

b4aAmateur

New Member
Function running time in timer is too long,How to deal with it?
for example:
B4X:
Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim Timer_Svc As Timer
End Sub

Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
    Dim lbl1 As Label
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    lbl1.Initialize("")
    Activity.AddView(lbl1,0,0,GetDeviceLayoutValues.Width,20dip)
    
    Timer_Svc.Initialize("TimerSvc", 1000)
    Timer_Svc.Enabled = True
End Sub
Sub TimerSvc_Tick
    Dim Ticks As Long = DateTime.Now
    lbl1.Text=DateTime.Time(Ticks)
    find
    Log(DateTime.Now - Ticks)
End Sub
Sub find
    Dim s As String
    For i = 1 To 10000
        s = s & i
    Next
End Sub
 
Top