43
4: Code samples
See “Code sample: Using tasks” on page 48 for more information.
Notify an application when a list of tasks changes
1.
Create a class that implements the
PIMListListener
interface.
class myTaskListListener implements PIMListListener {
2.
To register to receive notifications of changes to a task list, invoke
BlackBerryPIMList.addListener()
.
BlackBerryPIMList taskList =
(BlackBerryPIMList)PIM.getInstance().openPIMList(PIM.TODO_LIST, PIM.READ_WRITE);
taskList.addListener(new myTaskListListener());
Code samples
Code sample: Creating new recurring appointments
To let the BlackBerry® device user invite attendees to the meeting, combine this sample with ContactsDemo.java.
See “Code sample: Displaying a screen that lets BlackBerry device users add new contacts” on page 45 for more
information.
Example: EventDemo.java
/**
* EventDemo.java
* Copyright (C) 2002-2005 Research In Motion Limited.
*/
package com.rim.samples.docs.eventdemo;
import java.io.*;
import java.util.*;
import javax.microedition.pim.*;
import net.rim.device.api.ui.*;
import net.rim.device.api.ui.component.*;
import net.rim.device.api.ui.container.*;
import net.rim.device.api.i18n.*;
import net.rim.device.api.system.*;
import net.rim.device.api.util.*;
public final class EventDemo extends UiApplication
{
private EventScreen _eventScreen;
public static void main(String[] args) {
new EventDemo().enterEventDispatcher();
}
private EventDemo() {
_eventScreen = new EventScreen();
pushScreen(_eventScreen);
}
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...