Thanks Erel. One more question.
Is it possible to check if the time span is greater than another time span? I already used
B4X:
StateManager.SetSetting("Prevtime",PeriodToString(span))
'Check if span is greater
If PeriodToString(span) > StateManager.GetSetting("Prevtime") Then
Msgbox("You have beat your record","")
End If
It is possible, but you will need to write the code that checks it. If you are only dealing with hours or smaller intervals then it is quite simple to convert the Period to seconds and then compare it:
B4X:
Sub ShortPeriodToSeconds(p As Period) As Int
Return p.Hours * 3600 + p.Minutes * 60 + p.Seconds
End Sub