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...