Problem with the calendar lib - Date Range

thewavemaster

Member
Licensed User
Longtime User
Hello!

I'm using the calendar lib in one of my apps and have the following problem.
The user can click on a listview to get the calendar entry of the day (the app only allows one entry per day).

when I add a calender event on 12 th December 2012 for example everything is correct added to the google calendar. But when I now do a search for calendar entrys in the app this event is show on every date BEFORE 12 th december...?

Can u help me out?

B4X:
Sub ListView1_ItemClick (Position As Int, Value As Object)
Dim startd1 As Long
Dim endd1 As Long


   Dim datum_cal As String
   Dim ergebnis_tag As List
   ergebnis_tag.Initialize
   Dim mymap As Map 
   mymap.Initialize
   cal.Initialize

   mymap = cal.GetListOfAllCalendars(True)      'get a "Map" of the available calendars

   

   
   If Position < 9 Then
   datum_cal = "0" & (Position + 1) & "." & (Monat.SelectedIndex+1) & "." & Jahr.SelectedItem 
    Else
   datum_cal = (Position + 1) & "." & (Monat.SelectedIndex+1) & "." & Jahr.SelectedItem
   End If
   



   startd1 = DateTime.DateParse(datum_cal)
   endd1 = startd1 + DateTime.Add(startd1,0,0,1)
   
   ergebnis_tag = cal.GetListofEventsforCalendarBetweenDates(mymap.GetKeyAt(0), startd1,endd1)
   'ergebnis_tag = cal.ListofEventsWithDescKeywordBetweenDates(mymap.GetKeyAt(0),"Schichtler", startd1,endd1)
   
   Dim schleife As Int
   schleife =  0
   Dim count1, count2, count3, count4 As Int
   If ergebnis_tag.Size > 0 Then
      Dim end_ergebnis As List
      end_ergebnis.Initialize
      end_ergebnis.Clear
      For x = 0 To (ergebnis_tag.Size-1) Step 7
         If schleife =  0 Then
            If ergebnis_tag.Get(1) = "Schichtler" Then
            count1 = x
            count2= x+2
            count3 = x+3
            count4 = x+4
            
            end_ergebnis.Add(ergebnis_tag.Get(0))
            end_ergebnis.Add(ergebnis_tag.Get(2))
            end_ergebnis.Add(ergebnis_tag.Get(3))
            end_ergebnis.Add(ergebnis_tag.Get(4))
            schleife = 1
            Else
               Termin_lbl.Text = "Kein Termin!"
            End If
            Else
            Termin_lbl.Text = "Kein Termin!"
         End If
      Next

   
   If end_ergebnis.get(1) = end_ergebnis.Get(2) Then
   
   Termin_lbl.Text = "Ab:" & DateTime.Time(end_ergebnis.Get(1))  & " Uhr " & end_ergebnis.Get(0) & " Ort:" & end_ergebnis.Get(3)
   Else
   Termin_lbl.Text =  DateTime.Time(end_ergebnis.Get(1)) & "-" &  DateTime.Time(end_ergebnis.Get(2)) & " Uhr " & end_ergebnis.Get(0) & " Ort:" & end_ergebnis.Get(3)
   End If
   
   Else
   Termin_lbl.Text = "Kein Termin!"
   
   End If
   
   
   
   
   
   
End Sub
 
Top