×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    78

    Post Adding first and last name to the contact list

    hi,

    I doing a J2ME Application where i need to add the first name and the last name to my contact list in a "Sony-Ericsson' phone...Can anyone please send me the code or any link which will be helpfull for me .

    Thanks in Advance
    Deva

  2. #2
    Nokia Developer Expert
    Join Date
    Aug 2007
    Posts
    1,595

    Re: Adding first and last name to the contact list

    Hello Deva,

    you might want to check code examples available on Forum Nokia Wiki in case one of them would suit for your use case:

    Portal:Java Code Examples

    Regards,
    r2j7
    [URL="http://library.forum.nokia.com/java"][B] >>> Java Developer's Library <<<[/B][/URL]
    [URL="https://www.developer.nokia.com/Resources/Support/Technical_support.xhtml"] [B]>>> Technical Support for Java ME development <<<[/B][/URL]
    [URL="https://publish.ovi.com/info/"][B]>>> Nokia Publish: reach millions of Nokia users worldwide through Nokia Store <<<[/B][/URL]

  3. #3
    Regular Contributor
    Join Date
    Feb 2010
    Posts
    78

    Post Re: Adding first and last name to the contact list

    Quote Originally Posted by r2j7 View Post
    Hello Deva,

    you might want to check code examples available on Forum Nokia Wiki in case one of them would suit for your use case:

    Portal:Java Code Examples

    Regards,
    r2j7

    hi,

    I am doing a j2me contact details application in a Sony Ericsson phone....have attached my code below..


    Code:
    public void addDetails(){
    csize=0;
    int reainingsize=0;
    try {
    Contact contact = null;
    PIM pimInst = PIM.getInstance();
    contactList = (ContactList) pimInst.openPIMList(PIM.CONTACT_LIST,PIM.READ_WRITE);

    contact = contactList.createContact();
    csize = csize + 1; //indicates number of cotacts added to phonedatabase
    String[] name = new String[contactList.stringArraySize(Contact.NAME)];
    /* name[Contact.NAME_GIVEN] = "Manju";
    name[Contact.NAME_FAMILY] = "Varma";

    contact.addStringArray(Contact.NAME, Contact.ATTR_NONE,name);
    contact.addString(Contact.TEL, Contact.ATTR_NONE,"544545");
    contact.addString(Contact.TEL, Contact.ATTR_HOME,"2122555");
    contact.addString(Contact.TEL, Contact.ATTR_WORK,"54455");
    contact.addString(Contact.TEL, Contact.ATTR_MOBILE,"75565565");
    contact.addString(Contact.TEL, Contact.ATTR_MOBILE,"949655555");
    contact.addString(Contact.TEL, Contact.ATTR_MOBILE,"2586987321");
    contact.addString(Contact.TEL, Contact.ATTR_MOBILE,"3333333333");
    contact.addString(Contact.TEL, Contact.ATTR_MOBILE,"5565656565656");
    contact.addString(Contact.TEL, 24 ,"45444");
    contact.addString(Contact.TEL, 528 ,"5788444");
    contact.addString(Contact.EMAIL,Contact.ATTR_OTHER,"anju@aarthikaindia.com"); */



    if(contactList.isSupportedField(contact.TEL)){
    contact.addString(Contact.TEL,PIMItem.ATTR_NONE,"800-888-8888");
    contact.addString(Contact.TEL,PIMItem.ATTR_NONE,"800-888-8889");
    }

    if (contactList.isSupportedField(contact.ORG))
    contact.addString(Contact.ORG, PIMItem.ATTR_NONE,"Rain ,Inc.");

    if(contactList.isSupportedField(contact.EMAIL))
    contact.addString(Contact.EMAIL,PIMItem.ATTR_NONE,"support@acme.com");

    contact.commit();

    }catch (PIMException ex) {

    }
    finally{
    if (contactList != null){
    try {
    contactList.close();
    } catch (PIMException ex) {
    ex.printStackTrace();
    }
    contactList = null;
    }
    }
    }

    where the above code works fine in the "Nokia phone " but when i run the above code in a "Sony-Ericsson phone" am getting a Exception
    Can anyone solve the above problem.



    With Regards
    Deva

  4. #4
    Registered User
    Join Date
    Oct 2009
    Location
    Noida
    Posts
    941

    Re: Adding first and last name to the contact list

    where the above code works fine in the "Nokia phone " but when i run the above code in a "Sony-Ericsson phone" am getting a Exception
    Can anyone solve the above problem.
    Try on logging the exception and let us know, it due to which line of code..... I feel the issue is in following lines --

    if(contactList.isSupportedField(contact.TEL)){
    contact.addString(Contact.TEL,PIMItem.ATTR_NONE,"800-888-8888");
    contact.addString(Contact.TEL,PIMItem.ATTR_NONE,"800-888-8889");
    }

    try commenting out one of the above.

    thanks,
    Ekta

Posting Permissions

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