Blackberry JAVA DEVELOPMENT ENVIRONMENT - - CRYPTOGRAPHIC SMART CARD DRIVER - DEVELOPMENT GUIDE Průvodce řešením problémů Strana 165

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 286
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 164
165
11: Using PIM applications
Add appointment information. > To verify that an item supports a field, invoke isSupportedField(int).
if (event.isSupportedField(Event.SUMMARY)) {
event.addString(Event.SUMMARY, Event.ATTR_NONE, "Meet with customer");
}
if (event.isSupportedField(Event.LOCATION)) {
event.addString(Event.LOCATION, Event.ATTR_NONE, "Conference Center");
}
Date start = new Date(System.currentTimeMillis() + 8640000);
if (event.isSupportedField(Event.START)) {
event.addDate(Event.START, Event.ATTR_NONE, start);
}
if (event.isSupportedField(Event.END)) {
event.addDate(Event.END, Event.ATTR_NONE, start + 72000000);
}
if (event.isSupportedField(Event.ALARM)) {
if (event.countValues(Event.ALARM) > 0) {
event.removeValue(Event.ALARM,0);
event.setInt(Event.ALARM, 0, Event.ATTR_NONE, 396000);
}
}
Create a recurring appointment. 1. Create a RepeatRule object. The RepeatRule class defines the fields for the properties and
values that you can set, such as COUNT, FREQUENCY, and INTERVAL.
2. To retrieve an array of supported fields, invoke RepeatRule.getFields().
3. To define a recurring pattern, invoke setInt(int, int) or setDate(int, int, int,
long)
on a new RepeatRule object.
RepeatRule recurring = new RepeatRule();
recurring.setInt(RepeatRule.FREQUENCY, RepeatRule.MONTHLY);
recurring.setInt(RepeatRule.DAY_IN_MONTH, 14);
4. To assign a recurrence pattern to an appointment, invoke setRepeat(RepeatRule) on an
event.
EventList eventList = (EventList)PIM.getInstance().openPIMList(
PIM.EVENT_LIST, PIM.READ_WRITE);
Event event = eventList.createEvent();
event.setRepeat(recurring);
Change appointment information. 1. To replace an existing value with a new one, invoke the appropriate set method, such as
setString().
2. To determine if a value is already set for the field, invoke countValues().
3. To change an existing value, use the corresponding set method, such as setString().
if (event.countValues(Event.LOCATION) > 0) {
event.setString(Event.LOCATION, 0, Event.ATTR_NONE, "Board Room");
}
Task Steps
Zobrazit stránku 164
1 2 ... 160 161 162 163 164 165 166 167 168 169 170 ... 285 286

Komentáře k této Příručce

Žádné komentáře