Troubleshooting guide

188
BlackBerry Java Development Environment Development Guide
Code sample: Calculating the time that a participant spends on the phone
Example: PhoneLogsDemo.java
/**
* PhoneLogsDemo.java
* Copyright (C) 2001-2005 Research In Motion Limited. All rights reserved.
*/
package com.rim.samples.docs.phonelogs;
import net.rim.blackberry.api.phone.phonelogs.*;
import java.lang.*;
import net.rim.device.api.system.Application;
Retrieve a call participant by phone
number.
The PhoneCallLogID class identifies participants in a phone call log by phone number.
>Invoke PhoneCallLog.getParticipant(int) or
ConferencePhoneCallLog.getParticipantAt().
PhoneCallLogID participant = phoneCallLog.getParticipant();
PhoneCallLogID participant = ConferencePhoneCallLog.getParticipant();
Retrieve the phone number type. The PhoneCallLogID class identifies the type of phone call for a log. For example, home, mobile,
work, or fax, as recorded in the address book.
>Invoke PhoneCallLogID.getType().
String phoneType = PhoneCallLogID.getType();
Create a call log or conference call log. The PhoneCallLogID constructor removes dashes and other non-numeric characters from phone
numbers.
1. Create an instance of a PhoneCallLog or ConferencePhoneCallLog object, and provide
the date, duration, participants, and notes for the call as parameters to the constructor.
Date date = new Date("1000"); // date of call
int duration = 60; // duration of call
PhoneCallLogID caller1 = new PhoneCallLogID("555-1234"); // first
participant
PhoneCallLogID caller2 = new PhoneCallLogID("555-1235"); // second
participant
String notes = "New call."; // notes
ConferencePhoneCallLog conferenceCall = new
ConferencePhoneCallLog(date, duration,
PhoneLogs.FOLDER_NORMAL_CALLS, caller1, caller2, notes);
2. Update the call log:
To update the call log, invoke PhoneLogs.addCall(CallLog call).
_logs.addCall(conferenceCall);
To replace the call log with a new call log, invoke PhoneLogs.swapCall(CallLog
call,int index,long folderID)
.
_logs.swapCall(conferenceCall, 0, FOLDER_NORMAL_CALLS);
Delete a call log. >Invoke PhoneLogs.deleteCall().
_logs.deleteCall(0);
Task Steps