Hello
i using the PersianTimer library . This Library can Count Down number all the time! it means when activity is Paused, the timer is working too.
so i use this code
B4X:
Private Sub timer_onTick(Tag As String,TimeUntil As Int)
Time_Finish = TimeUntil
Dim seconds, minutes As Int
seconds = Time_Finish
minutes = Floor(seconds / 60)
seconds = seconds Mod 60
Try
If Time_Finish < 10 Then
LBL_Timer.TextColor = Colors.Red
End If
LBL_Timer.Text = NumberFormat(minutes, 2, 0) & ":" & NumberFormat(seconds,2,0)
Catch
Log(LastException)
End Try
End Sub
this code is showing the timer on label. and when activity going to be Pause, my app will be force close! because it want to set text on label when activity Paused!
Is there any way to know activity is pause or no?
it means it should be
B4X:
Private Sub timer_onTick(Tag As String,TimeUntil As Int)
Time_Finish = TimeUntil
Dim seconds, minutes As Int
seconds = Time_Finish
minutes = Floor(seconds / 60)
seconds = seconds Mod 60
if Status_Activity("Resume") = true then
If Time_Finish < 10 Then
LBL_Timer.TextColor = Colors.Red
End If
LBL_Timer.Text = NumberFormat(minutes, 2, 0) & ":" & NumberFormat(seconds,2,0)
End if
End Sub