blackberry - how to get the events from native calendar for a specific date -
i trying events native calendar date given user,i not able events date specific.how can ?
private void getevents() { try { eventlist eventlist = (eventlist)pim.getinstance().openpimlist(pim.event_list, pim.read_only); enumeration events = eventlist.items(); while (events.hasmoreelements()) { event event = (event)events.nextelement(); if(eventlist.issupportedfield(event.location) && event.countvalues(event.location) > 0) { string location = event.getstring(event.location, 0); dialog.alert(location); } if(eventlist.issupportedfield(event.summary) && event.countvalues(event.summary) > 0) { string subject = event.getstring(event.summary, 0); dialog.alert(subject); } if(eventlist.issupportedfield(event.start) && event.countvalues(event.start) > 0) { long start = event.getdate(event.start,0); simpledateformat sdf = new simpledateformat("mmm dd, yyyy hh:mm"); string datestring = sdf.formatlocal(start); dialog.alert(datestring); } if(eventlist.issupportedfield(event.end)&& event.countvalues(event.end) > 0) { long end = event.getdate(event.end, 0); simpledateformat sdf = new simpledateformat("mmm dd, yyyy hh:mm"); string datestring = sdf.formatlocal(end); dialog.alert(datestring); } } } catch (pimexception e) { dialog.alert(e.getmessage()); } }
how modify code displayed given date ?
how about:
calendar cal = calendar.getinstance(); cal.settimemillis(start); if (cal.get(calendar.year) == requestedyear && cal.get(calendar.month) == requestedmonth && cal.get(calendar.day) == requestedday) { // display event }
Comments
Post a Comment