Android Question MaterialDatetimePicker OnTimeSet Problem

Uederson Ferreira

Member
Licensed User
Hi all!
If I choose a time like "01:00" it returns minutes "0", and if I choose "01:05", it returns "5".
I know it is because minute returns as int. I had a lot of work trying to solve it, but I think there is an easier way.

Thank you in advanced!

Uederson
 

DonManfred

Expert
Licensed User
Do not expect any change in the lib. I do not have the source anymore.
You need to write a small workaround-sub.
 
Upvote 0

Uederson Ferreira

Member
Licensed User
Great!
My workaround was (if it is usefull for someone else):

B4X:
Sub time_onTimeSet (hour As Int, minute As Int, second As Int)
    If minute == 0 Then
        label.Text = hour &":00"
    Else If minute > 0 And minute < 10 Then
        label.Text = hour &":0"&minute
    Else
        label.Text = hour &":"&minute
    End If
End Sub

Thank you, friend!
 
Upvote 0

udg

Expert
Licensed User
B4X:
label.text = $"$2.0{hour}:$2.0{minute}"$
 
Upvote 0

GMan

Well-Known Member
Licensed User
What is the "$" Character for ?
 
Upvote 0
Top