Search code examples
basic4android

How to create a countdown timer in B4Android


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!


Solution

  • If you just want to find the hours and minutes you can use code similar to:

    Dim i As Int
    i = EditText1.Text.IndexOf(":")
    If i = -1 Then
        Msgbox("Invalid value.", "")
        Return
    End If
    Dim hours, minutes As Int
    hours = EditText1.Text.SubString2(0, i)
    minutes = EditText1.Text.SubString(i + 1)