Android Question I Need A Simple Date Picker.. And Time Picker

Big Dave

Member
Licensed User
Longtime User
Hello

I have a program with a number of date and time label fields. I want to be able to "pick" dates and times, separately, and populate the respective date and time fields. I would like the position of the "pick" panel to show directly below the respective date or time label fields as needed, and ideally they should look the same for date and time "picks". I don't mind if it is a wheel type selection or a "pick" type selection.

I know there are several choices available but I have been going round in circles trying to get some of them to work, so example coding would be very helpful.

Thanks for looking.

David
 

Big Dave

Member
Licensed User
Longtime User
Erel

Many thanks for your fast reply. I have tried AnotherDatePicker but got somewhat confused with what I needed to setup within the designer. To explain:

I managed to download the class, add it to my program etc as per the instructions. I have the date field as a label and want to click the label, select a date and populate that with the "picked" date in a specific format(dd/mm/yy). However all I could achieve is to get the date (yymmdd) showing in a customview field on the screen. Also I could see no way of setting the position or size of the date picker panel.

I will go back and have another go but it is somewhat frustrating going round and round in circles!!

Many thanks.

David
 
Upvote 0

Big Dave

Member
Licensed User
Longtime User
Erel

I downloaded AnotherDatePicker today and according to the comments it is version 1.11. I have changed my program and removed the date label and added the customview field. Now I am back where I started in that I get a date in yymmdd format where I want to show it in dd/MM/yy format.

Not sure what example project you are talking about?

I added the two lines to the designer script and they caused a compilation error. This may be because I have commented out the AutoScaleAll line which seems to corrupt my layout. All my screens run full screen landscape orientation and everything is set to specific x/y positions.

Many thanks.

David
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Set the DateFormat:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   Activity.LoadLayout("1")
   DateTime.DateFormat = "dd/MM/yy"
End Sub

SS-2014-04-28_09.23.38.png
 
Upvote 0
Top