I have this type:
and use this code to populate the map and insert in a list:
but I don't know how to use IndexOf to check if value exists and retrieve the EventName.
I tried to make this, but don't works:
it's possible to use the IndexOf in a List with Map to find directly the item?
Thanks in advance for any tip.
B4X:
Type Events (EventName As String, EventDate As Long)
and use this code to populate the map and insert in a list:
B4X:
Dim NewList As List
NewList.Initialize
Dim dt As Event : dt.Initialize
dt.EventDate = DateTime.DateParse(12 & "/" & 25 & "/" & 2015)
dt.EventName = "Christmas"
NewList.Add(dt)
Dim dt As Event : dt.Initialize
dt.EventDate = DateTime.DateParse(1 & "/" & 1 & "/" & 2015)
dt.EventName = "New Year"
NewList.Add(dt)
but I don't know how to use IndexOf to check if value exists and retrieve the EventName.
I tried to make this, but don't works:
B4X:
Dim newDate As Long = DateTime.DateParse(12 & "/" & 25 & "/" & 2015)
Dim f As Int
f = NewList.IndexOf(newDate)
If f > -1 Then
Log("Christmas Found")
End If
it's possible to use the IndexOf in a List with Map to find directly the item?
Thanks in advance for any tip.