How to put reminder in Blackberry calendar

Posted by anta40 on Stack Overflow See other posts from Stack Overflow or by anta40
Published on 2010-08-31T23:02:27Z Indexed on 2011/01/17 13:53 UTC
Read the original article Hit count: 199

Filed under:
|
|

I need to put several reminders in the BB calendar. The idea is several hours, or days before a promo expires, the alarm will remind it for you.

Here's my code so far:

long ONE_HOUR = 3600;
long ONE_DAY = 24 * 3600;

try {
 EventList eventList =  (EventList)PIM.getInstance().openPIMList(PIM.EVENT_LIST, PIM.READ_WRITE);
 BlackBerryEvent bbEvent = (BlackBerryEvent) eventList.createEvent();
 FavoritePromo promo;

 if (eventList.isSupportedField(BlackBerryEvent.ALARM)){

  for (int x = 0; x < promos.size(); x++){
   promo = (FavoritePromo) promos.elementAt(x);
   time = (StringUtil.strToDate(promo.getExpireDate())).getTime() - value;
   bbEvent.addString(BlackBerryEvent.SUMMARY, BlackBerryEvent.ATTR_NONE, promo.getTitle());
   bbEvent.addDate(BlackBerryEvent.ALARM,0,time);
   bbEvent.commit();
  }
 }
}
catch (PIMException e){

}

Every time i run it, an "IllegalArgumentException" is always thrown. I'm not really sure what goes wrong here...

© Stack Overflow or respective owner

Related posts about blackberry

Related posts about calendar