×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Aug 2007
    Posts
    31

    Question adding a new contact in S40 using java

    hi
    i´m developping an application in java for the nokia s40's phones, and i working with the jsr-75 PIM. I got an option in my applications, and this is to add new contacts in the list of the phone, addinig the name, the phone and the email. The problem is that when i add a new contact, and i search for it in the contact list of the phone, it doesn't have the name, it says that the contact is unnamed.
    i use the following code:

    Code:
    PIM pim = PIM.getInstance();
    		PIMList lista = null;
    		String[] listas = pim.listPIMLists(PIM.CONTACT_LIST);
    		ContactList listaContactos = null;
    		
    		try {
    		   lista = PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE, listas[0]);
    		   listaContactos = (ContactList) PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE, listas[0]);
    		} catch(Exception e) {
    		   // security or other exception
    		}		
    		
    //		Add contact values
    		Contact nuevoContacto = listaContactos.createContact();
    			nuevoContacto.addString(Contact.FORMATTED_NAME, Contact.ATTR_PREFERRED, newNombre);
    and tried using the next instructions, but it says that those are invalid fields.

    Code:
    nuevoContacto.addString(Contact.NAME, Contact.ATTR_PREFERRED, newNombre);
    nuevoContacto.addString(Contact.NAME_FAMILY, Contact.ATTR_PREFERRED, newNombre);
    nuevoContacto.addString(Contact.NAME_GIVEN, Contact.ATTR_PREFERRED, newNombre);
    nuevoContacto.addString(Contact.NAME_OTHER, Contact.ATTR_PREFERRED, newNombre);
    nuevoContacto.addString(Contact.NAME_PREFIX, Contact.ATTR_PREFERRED, newNombre);
    nuevoContacto.addString(Contact.NAME_SUFFIX, Contact.ATTR_PREFERRED, newNombre);
    Can anyone help me?

  2. #2
    Nokia Developer Champion
    Join Date
    Nov 2007
    Location
    Rome, Italy
    Posts
    2,405

    Re: adding a new contact in S40 using java

    Try using the PIMList getSupportedFields() method to get the supported field list (getFieldLabel() could be useful to identify the one you're searching).

    Hope it helps
    Pit

Similar Threads

  1. Adding image using Vcard S40 3rd edition
    By vinay_parsi in forum Mobile Java General
    Replies: 0
    Last Post: 2007-05-24, 12:56
  2. Problem about contact adding........
    By redsunny in forum Symbian C++
    Replies: 0
    Last Post: 2004-07-29, 04:10
  3. Problem adding contact
    By jsstewart in forum Symbian C++
    Replies: 1
    Last Post: 2004-02-17, 13:22
  4. j2ME, java enabled, and the 3410
    By davidkangaroo in forum Mobile Java General
    Replies: 2
    Last Post: 2002-07-05, 22:30

Posting Permissions

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