B4A Library DateTimePicker View

DateTimePicker view is based on the CustomListView and snapCLV with a design similar to the ios datetime picker. This view has only been tested in B4A, it is not very useful in B4i since for ios the built-in picker is better.


1. Add the module and layout to your project (attached files). You should not modify this layout, it is for internal use only.
Download de layout file depending on the platform you want to use, .bal for B4A. For B4i and B4j download the zip file with the corresponding name.
2. Add the DateTimePicker custom view to your own layout in the designer.
3. Set the min,max dates and it is ready to use.

Remember to add the CustomListView and XUI library to your project.

Sub Globals
    Private DateTimePicker1 As DateTimePicker
End Sub
Sub Activity_Create(FirstTime As Boolean)
    Activity.LoadLayout("1") 'Layout with the datetimepicker custom view

    ToastMessageShow("Click the activity",True)
End Sub
Sub Activity_Click
    If DateTimePicker1.Selected > 0 Then
    End If
End Sub

Version 1.4

-Added "fade away" effect
-Return the date as long value or a list of the selected values, each as a string
-Fixed an issue that didn't draw the lines in B4j

Version 1.3
-Probably Multiplatform. Download de layout file depending on the platform you want to use, .bal for B4A. For B4i and B4j download the zip file with the corresponding name.
-Fixed an issue that may prevent some cases to compile.

Version 1.2
-Fixed an issue that returned datetime = -1
-Now you can set the text color, line color and background color
-Other minor details


  • datetimelayout.bal
    4.2 KB · Views: 710
  • datetimelayoutB4i.zip
    1.5 KB · Views: 458
  • datetimelayoutB4j.zip
    1.5 KB · Views: 468
  • screenshot_DateTimePicker.jpg
    108.1 KB · Views: 450
  • DateTimePicker.bas
    18.6 KB · Views: 469
  • DateTimePicker_1.14_B4A_example.zip
    13.9 KB · Views: 611
  • DateTimePicker_1.14_B4J_example.zip
    7.2 KB · Views: 483
Last edited:


Well-Known Member
Licensed User
Thanks for responding....
I thought for some reason that the library in #1 there was still labelled as an earlier version. Il go back and grab it .

I will make a test dummy for you when I get to the machine. But - I probably did something dumb - like not intialising properly etc. etc.. ( so maybe no test dummy necessary - will review it).

Also, thanks for the example. Did make a work around. I wanted a Really simple user input side . I like the whole dialogue look of yours.

What I couldn't get right was a return value from the user selected date (only got the current date back not the one in the header box). I am sure your example will reveal my coding omissions. Maybe it's a documentation thing?

I tried another library before I found yours, but there are issues with how it worked under B4XPages - also couldn't get it's selected date return value.

I'll let you know here what transpires.


Well-Known Member
Licensed User
Hello again @jtare :
I have 1.14 now.

Sorted out the idiocy on my side which got rid of the "Unknown member" thing.... {{It seems I have a library in the Additional called DateTimePicker 1.01 that caused that problem - turned it off and solved. Now it just sees the Class module DateTimePicker.bas. Incidentally, the 1.01 produced a really nice Month-view dialogue - the one I liked to be using.}} These last comments a probably most relevant to #16 (haven't looked at #17 example yet.).

I thought that there could be an issue with B4XPages and so I redid your example as B4XPages using the flow logic I expect to be using (and which did not work with the other library). SO, that conversion is working. (#11 true)

I could not find how you got the layout in the middle image at the top of #1. I noted (#16) that your intent was to not extend outside of the current year - though obviously that would be workable. Essentially I only need ddmmyyyy no time needed and my date range would be something like 2000->2040. (will figure that out with SetMinDate SetMaxDate -> and unpacking #14 text again and #17 example.)

That's about it. Thanks again for giving me your time and attention, I'll swim upstream from here, Cheers.

(PS seemed there was no necessity to produce a Test Dummy)


Active Member
Licensed User
Longtime User
I could not find how you got the layout in the middle image at the top of #1.
You can achieve that changing the colors. Look this example:


DateTimePicker1.backgroundColor = Colors.Black
DateTimePicker1.focusedTextColor = Colors.White
DateTimePicker1.lineColor = Colors.Yellow
DateTimePicker1.fadeAwayEffect = True 'New


I hope it helps