Unable to read General number of a native Phonebook contact in Series 40 (Known Issue)
Article Metadata
Tested with
Compatibility
Article
Contents |
Overview
FileConnection and PIM API (JSR-75) cannot read the General number of an inserted native Phonebook contact in Series 40.
Description
The FileConnection and PIM API (JSR-75) can be used for reading from and writing to contacts of the native Phonebook application. However, if the user inserts the General phone number field to a Phonebook contact using the native Phonebook in Series 40, the FileConnection and PIM API cannot read the inserted General phone number field. All the other phone number fields can be read without problems.
How to reproduce
The described problem can be reproduced as follows:
1. By using a Series 40 device, browse for the native Phonebook application('Menu' -> 'Contacts').
2. Insert a new contact to the native Phonebook application.
3. Insert General phone number field for the new contact ('Options' -> 'Add detail' -> 'Number' -> 'General') and insert a number into the field.
4. Insert other phone number fields ('Mobile', 'Home', etc.) for the new contact.
5. Implement the test MIDlet using the following code:
import java.util.Enumeration;
import javax.microedition.midlet.MIDlet;
import javax.microedition.lcdui.*;
import javax.microedition.pim.*;
public class ContactGeneralNumber extends MIDlet implements CommandListener {
private Form f;
private Display d;
private Command exitCmd;
private Command searchCmd;
public ContactGeneralNumber() {
f = new Form("Phone number read test");
// Adding command buttons
searchCmd = new Command("Search", Command.OK, 0);
exitCmd = new Command("Exit", Command.EXIT, 1);
f.addCommand(searchCmd);
f.addCommand(exitCmd);
f.setCommandListener(this);
d = d.getDisplay(this);
d.setCurrent(f);
}
public void commandAction(Command cmd, Displayable dable) {
if (cmd == exitCmd) {
notifyDestroyed();
} else if (cmd == searchCmd) {
try {
searchContact();
} catch (PIMException ex) {
ex.printStackTrace();
f.append("Error: " +ex.toString());
}
}
}
/* Search the added contact, count its phone number fields, access all the
fields, and put their content visible on the Form. */
private void searchContact() throws PIMException {
PIM pim = PIM.getInstance();
PIMList list = pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY);
Enumeration en = list.items();
while (en.hasMoreElements()) {
Contact contact = (Contact) en.nextElement();
int count = contact.countValues(Contact.TEL);
for (int index = 0; index < count; index++) {
f.append("" + index + " :");
String value = contact.getString(Contact.TEL, index);
f.append("" + value + "\n");
d.setCurrent(f);
}
}
}
public void startApp() {
}
public void pauseApp() {
}
public void destroyApp(boolean unconditional) {
}
}
6. Install and launch the test MIDlet and press 'Search'. The MIDlet returns data for all the other fields but not for the General phone number field.
Solution
No solution exists.


(no comments yet)