Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Jul 2008

    how to access phonebook

    how to enter a number from a midlet into the phonebook of the mobile and i have used the package jsr75 but i number is not shown in the contact list of the phone book.
    Please give some suggestion or some sample code

  2. #2
    Registered User
    Join Date
    Jan 2008

    Re: how to access phonebook

    Hi praran910

    try with this code:
    Contact contact = contacts.createContact();
    String[] name = new String[contacts.stringArraySize(Contact.NAME)];

    if (contacts.isSupportedField(Contact. FORMATTED_NAME))
    contact.addString(Contact. FORMATTED_NAME, PIMItem.ATTR_NONE, "Name");
    if (contacts.isSupportedArrayElement(Contact.NAME, Contact.NAME_FAMILY))
    name[Contact.NAME_FAMILY] = "XYZ";

    contact.addStringArray(Contact.NAME, PIMItem.ATTR_NONE, name);

    if (contacts.isSupportedField(Contact.TEL))
    contact.addString(Contact.TEL, Contact.ATTR_HOME, "+911234567890"); //HOME


    try {
    } catch (PIMException e) {
    // An error occured

    this code may help you

  3. #3
    Registered User
    Join Date
    Jul 2008

    Re: how to access phonebook

    First of all thanks for the reply

    I have tried with that but it did not work on the nokia mobile i had even imported the jsr75 package but the number is not being saved on the mobile phonebook.

  4. #4
    Super Contributor
    Join Date
    Oct 2007
    Deva, Romania

    Re: how to access phonebook

    Try this:
    import javax.microedition.pim.*;
    public void startApp() {
            // Open default contact list
            PIM pim = PIM.getInstance();
            ContactList clist;
            try {
                clist = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE);
                //Add contact values
                Contact c = clist.createContact();
                int attrs = Contact.ATTR_HOME;
                c.addString(Contact.TEL, attrs, "416-799-1313");
                // Some fields can be added without attributes
                c.addString(Contact.ORG, PIMItem.ATTR_NONE, "someName Corporation");
                // Add the item to the native contact database
            catch(Exception e) {
                // security or other exception
    This is just a simple example, but I tested it in an S60 emulator and it worked. For more info you can check this page.

Similar Threads

  1. Phonebook access
    By logica2k in forum Symbian
    Replies: 10
    Last Post: 2008-09-04, 06:20
  2. Nokia 6101 Locked 2 TMobile Midlet can't access internet...
    By Jason Glass in forum Mobile Java Networking & Messaging & Security
    Replies: 45
    Last Post: 2007-11-14, 02:19
  3. Phonebook access
    By songoku83 in forum Symbian
    Replies: 8
    Last Post: 2007-08-03, 15:27
  4. Access to Series 40 Phonebook
    By gruthe in forum General Development Questions
    Replies: 1
    Last Post: 2004-11-02, 18:35

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts