icalendar - Android: Not All Instances of Recurring Event Saved -


i working on creating custom calendar application , have been struggling saving recurring event. if example set event occur daily 100 days seeing 38 instances saved instances database. not sure why happening.

here code adds/updates event

public event addupdatecalendarevent(context ctx, event event) throws interruptedexception {      contentresolver contentresolver = ctx.getcontentresolver();      contentvalues calevent = new contentvalues();     calevent.put(events.calendar_id, event.getcalendarid());      calevent.put(events.title, event.geteventname());     calevent.put(events.dtstart, event.getdatefrom().gettimeinmillis());      calevent.put(events.event_timezone,event.getdatefrom().gettimezone().getid());     if(event.isallday()) {         calevent.put(events.all_day, 1);     }     if(null != event.getrrule()) {         string rrule = recurrenceruleconverter.tostring(event.getrrule());         log.d("rrule: ", rrule);         calevent.put(events.rrule, rrule);     }     if(null != event.getduration()) {         calevent.put(events.duration, event.getduration());     }     if(null != event.getdateto()) {         calevent.put(events.dtend, event.getdateto().gettimeinmillis());     }     uri uri = null;     try {          if(null != event.geteventid()) {             uri = contenturis.withappendedid(events.content_uri, event.geteventid());             contentresolver.update(uri, calevent, null, null);         }         else {             uri = contentresolver.insert(events.content_uri, calevent);         }     }     {         event.seteventid(integer.parseint(uri.getlastpathsegment()));     }     return event; } 

directly after call addupdate method call method list instances

public list<event> geteventinstances(context context, integer calendarid, integer eventid) {     // projection array. creating indices array instead of doing     // dynamic lookups improves performance.     final string[] event_projection = new string[] {         calendarcontract.instances.calendar_id,         calendarcontract.instances._id,          calendarcontract.instances.begin,          calendarcontract.instances.end,         calendarcontract.instances.title,         calendarcontract.instances.rrule,         calendarcontract.instances.event_id,         calendarcontract.instances.event_timezone,         calendarcontract.instances.all_day     };      // run query     cursor cur = null;     contentresolver cr = context.getcontentresolver();       uri.builder builder = calendarcontract.instances.content_uri.buildupon();      contenturis.appendid(builder, long.min_value);     contenturis.appendid(builder, long.max_value);      uri uri = builder.build();     list<event> events = new arraylist<event>();     string selection = "((" + instances.calendar_id + " = ?) , (" + instances.event_id + " = ?))";     string[] selectionargs = new string[] {string.valueof(calendarid),string.valueof(eventid)};      try {         cur = cr.query(uri, event_projection, selection, selectionargs, null);          while (cur.movetonext()) {             event event = new event();             event.setcalendarid(cur.getint(0));             java.util.calendar calfrom = java.util.calendar.getinstance();             calfrom.settimeinmillis(long.valueof(cur.getlong(2)));             java.util.calendar calto = java.util.calendar.getinstance();             calto.settimeinmillis(long.valueof(long.valueof(cur.getlong(3))));             event.setdatefrom(calfrom);             event.setdateto(calto);             event.settitle(cur.getstring(4));             event.seteventid(cur.getint(6));             recurrencerule rule = new recurrencerule();             rule.setruleastext(cur.getstring(5));             event.setrrule(rule);               event.setallday(cur.getint(8) == 1);             log.d("event:", event.gettitle() + " calendarid: "  + event.getcalendarid() + " eventid: " + event.geteventid() + " " + dateutil.datetimeformat.format(calfrom.gettime()) + " " + dateutil.datetimeformat.format(calto.gettime()) + " timezone: " + cur.getstring(7));              events.add(event);         }     }     {         cur.close();         sortlisteventsbydate(events);         log.d("geteventinstances size", string.valueof(events.size()));      }     return events; } 

here example of properties of event tried save occurred daily 100 days:

event   event  (id=830026469328)     calendarid  integer  (id=830015046320)   datefrom    gregoriancalendar  (id=830027217712)     dateto  null     duration    "p1h" (id=830029516016)  eventid integer  (id=830029520232)   eventname   "ginos pizza" (id=830044532096)  eventtimezone   "central standard time" (id=830024050504)    isallday    false    rdate   null     rrule   ruleastext  "freq=daily;count=100" (id=830029519256)     

here event information vcd file:

begin:vcalendar version:1.0 prodid:vcal id default tz:-05:00 begin:vevent uid:content://com.android.calendar/events/1187 dtend:20130810t040000z dtstart:20130810t030000z due:p3600s completed:20131117t050000z rrule:freq=daily;count=100 summary;encoding=quoted-printable;charset=utf-8:=67=69=6e=6f=73=20=70=69=7a=7a=61 status:tentative end:vevent end:vcalendar 

can't figure out why saving fraction of instances. please help!!! please let me know if need see other information.

thank you, aaron

i figured out while ago...sorry didn't add earlier. issue passing in long.min , long.max when searching through events. solved issues loading events 1 month @ time.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -