45
4: Code samples
}
// Save the appointment to the Calendar.
event.commit();
//reset fields on screen
_subject.setText(““);
_location.setText(““);
_endTime.setDate(null);
_startTime.setDate(null);
_repeat.setSelectedIndex(0);
return true;
} catch (PIMException e) {
System.err.println(e);
}
return false;
}
private RepeatRule setRule() {
RepeatRule rule = new RepeatRule();
int index = _repeat.getSelectedIndex();
if (index == 0) {
rule.setInt(RepeatRule.FREQUENCY, RepeatRule.DAILY);
}
if (index == 1) {
rule.setInt(RepeatRule.FREQUENCY, RepeatRule.WEEKLY);
}
if (index == 2) {
rule.setInt(RepeatRule.FREQUENCY, RepeatRule.MONTHLY);
}
if (index == 3) {
rule.setInt(RepeatRule.FREQUENCY, RepeatRule.YEARLY);
}
return rule;
}
protected void makeMenu(Menu menu, int instance) {
menu.add(_saveMenuItem);
menu.addSeparator();
super.makeMenu(menu, instance);
}
}
}
Code sample: Displaying a screen that lets BlackBerry device users add new
contacts
The following sample demonstrates how to display a screen that lets BlackBerry® device users add new contacts
to the address book.
Example: ContactsDemo.java
/**
* ContactsDemo.java
* Copyright (C) 2002-2005 Research In Motion Limited.
Summary of Contents for JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE
Page 4: ......
Page 7: ......
Page 10: ...10 BlackBerry Device Applications Integration Guide...
Page 12: ...12 BlackBerry Device Applications Integration Guide...
Page 50: ...50 BlackBerry Device Applications Integration Guide...
Page 56: ...56 BlackBerry Device Applications Integration Guide...
Page 65: ......
Page 66: ...2008 Research In Motion Limited Published in Canada...