Fill spinner with dates

stratus

Active Member
Licensed User
Longtime User
How can i fill a spinner with dates (format dd/mm/yyyy) from today until the end of year?
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Here:
B4X:
Sub Globals
    Dim spnr As Spinner    
End Sub

Sub Activity_Create(FirstTime As Boolean)
    spnr.Initialize("spnr")
    Dim year As Int
    year = DateTime.GetYear(DateTime.Now) 'find the current year
    Dim i As Long
    DateTime.DateFormat = "dd/MM/yyyy"
    i = DateTime.Now
    Do While DateTime.GetYear(i) = year
        spnr.Add(DateTime.Date(i))
        i = DateTime.Add(i, 0, 0, 1)
    Loop
    Activity.AddView(spnr, 10dip, 10dip, 200dip, 70dip)
End Sub
Note that a ListView may be better for this purpose as you can enable the "fast scroller" which can be useful here.
 
Upvote 0

GMan

Well-Known Member
Licensed User
Longtime User
How can i populate the spinner with entries from a simple textfile from the internet ?
 
Upvote 0
Top