Android Question Countdown Timer

I'm new to programing and to B4Android. I am trying to create an app that will let me insert the time into an EditText, display it on a Label and then start counting. How do I parse my result in EditText into Hours / Minutes using B4A? I would really appreciate any help!
 
i don't know how to manually set the time to EditText and display it to Label. can someone help me with my problem? this is my First time in B4A i want to learn.



B4X:
Sub Process_Globals
    Private timer1 As Timer
    Private targetTime As Long
 
End Sub

Sub Globals

    Private EditText1 As EditText
    Private Go As Button
    Private Label1 As Label
    Private Pause As Button
    Private Reset As Button
    Private Set As Button
End Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Activity.LoadLayout("timerlayout")
    If FirstTime Then
        timer1.Initialize("timer1", 1000)
    End If
    StartTimer(4)
End Sub

Sub Activity_Resume

End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub StartTimer ( minutes As Int)
    targetTime = DateTime.Now + minutes * DateTime.TicksPerMinute
 
End Sub

Sub Timer1_Tick
    Dim t As Long = Max(0, targetTime - DateTime.Now)
    Dim   minutes, seconds As Int
    minutes = (t Mod DateTime.TicksPerHour) / DateTime.TicksPerMinute
    seconds = (t Mod DateTime.TicksPerMinute) / DateTime.TicksPerSecond
    Log($"$1.0{minutes}:$1.0{seconds}"$)
 
End Sub


Sub Set_Click
 
End Sub

Sub Reset_Click
 
End Sub

Sub Pause_Click
    timer1.Enabled = False
End Sub

Sub Go_Click
    timer1.Enabled = True
End Sub
 
Last edited:
Upvote 0
This is the Design of my app I've search possible solution for my problems in Google but i can't find any of it. );
 

Attachments

  • Capture.PNG
    Capture.PNG
    44.7 KB · Views: 636
Upvote 0
Top