Android Question AnotherDatePicker (B4X) error r/w to a Map

LucaMs

Expert
Licensed User
Longtime User
I'm using a Map to save a date (long) selected with AnotherDatePicker.

When I read the map I get "strange" error (set a breakpoint on line 67 - Dim lngDate...).
 

Attachments

  • AnotherDatePicker test.zip
    13.2 KB · Views: 337

DonManfred

Expert
Licensed User
Longtime User
B4X:
Sub Read
    Log("Reading")
    If File.Exists(File.DirInternal, DATES_FILENAME) Then
        mmapDates = File.ReadMap(File.DirInternal, DATES_FILENAME)
        Log(mmapDates)
        For Each key As String In mmapDates.Keys
            If key = DATES_FIRST_KEY Then
                Dim lngDate As Long = mmapDates.Get(key)
                AnotherDatePicker1.Date = lngDate
            End If
        Next
    End If
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i suggest to use String as KEytype

in this case
B4X:
    Private Const DATES_FIRST_KEY As String = "1"

does work without the loop over all keys

B4X:
Sub Read
    Log("Reading")
    If File.Exists(File.DirInternal, DATES_FILENAME) Then
        mmapDates = File.ReadMap(File.DirInternal, DATES_FILENAME)
        Log(mmapDates)
        'For Each key As String In mmapDates.Keys
        '    If key = DATES_FIRST_KEY Then
        Dim lngDate As Long = mmapDates.Get(DATES_FIRST_KEY)
                AnotherDatePicker1.Date = lngDate
            'End If
        'Next
    End If
End Sub
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
Upvote 0
Top