Blackberry JAVA DEVELOPMENT ENVIRONMENT - - DEVICE APPLICATIONS INTEGRATION - DEVELOPMENT GUIDE Integration Manual page 55

Blackberry device applications integration guide
Table of Contents

Advertisement

import java.lang.*;
import net.rim.device.api.system.Application;
public class PhoneLogsDemo extends Application
{
private PhoneLogs _logs;
private int _timeSpokenTo;
static public void main(String[] args) {
PhoneLogsDemo app = new PhoneLogsDemo();
app.enterEventDispatcher();
}
private PhoneLogsDemo() {
_logs = PhoneLogs.getInstance();
PhoneCallLogID participant = new PhoneCallLogID("5551234");
_timeSpokenTo = findTimeSpokenTo(participant,
}
// Returns the number of seconds spent on the phone with a participant.
public int findTimeSpokenTo(PhoneCallLogID participant,
long folder) {
int numberOfCalls = this._logs.numberOfCalls(folder);
int timeSpokenTo = 0;
PhoneCallLog phoneCallLog;
ConferencePhoneCallLog conferencePhoneCallLog;
for (int i = 0; i < numberOfCalls; i++) {
Object o = _logs.callAt(i, folder);
if (o instanceof PhoneCallLog) {
phoneCallLog = (PhoneCallLog) o;
if ( phoneCallLog.getParticipant() == participant)
} else {
conferencePhoneCallLog = (ConferencePhoneCallLog) o;
int participants = conferencePhoneCallLog.numberOfParticipants();
for (int j = 0; j < participants; j++)
}
}
return timeSpokenTo;
}
}
PhoneLogs.FOLDER_NORMAL_CALLS);
timeSpokenTo += phoneCallLog.getDuration();
if (conferencePhoneCallLog.getParticipantAt(j) == participant) {
timeSpokenTo += conferencePhoneCallLog.getDuration();
j = participants;
}
5: Code sample
55

Advertisement

Table of Contents
loading

This manual is also suitable for:

Java development environment 4.6.0

Table of Contents