×

Discussion Board

Results 1 to 9 of 9
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Red face JSR - 75 API problem

    Hi Everyone
    I am working on JSR 75 API in an application. With JSR 75 I am not being able to view "unnamed" contacts (Unnamed contacts are those contacts which contain some mobile number or other field info except name field).

    Please reply if any body knows the way to show "unnamed" contacts.

    Thanks
    Pooja Goel
    Software Engineer
    CHD,India

  2. #2
    Regular Contributor
    Join Date
    Sep 2006
    Location
    Delhi
    Posts
    77

    Re: JSR - 75 API problem

    Can you post your piece of code in which you are trying to retrieve the Contacts
    regards

    Sunil (sunilmnaik@gmail.com)

  3. #3
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Arrow Re: JSR - 75 API problem

    Ya sure:
    \\This is the code which i am using to view phone book contacts in myContactList. Please tell me is it feasible to view "unnamed" contacts through JSR 75.
    //Code to retrieve the phone book contacts
    String listNameToOpen = showContactList.getString(showContactList.getSelectedIndex());
    PIMList list = PIM.getInstance().openPIMList(PIM.CONTACT_LIST , PIM.READ_ONLY, listNameToOpen);
    int i = 0;
    myContactList = new List("Contact List", List.MULTIPLE);
    for (Enumeration enumItems = list.items(); enumItems.hasMoreElements() {
    PIMItem item = (PIMItem) enumItems.nextElement();
    int codeName = Contact.FORMATTED_NAME; contactNameVector.addElement(item.getString(codeName, 0));
    i++;
    }
    for(int j =0; j< contactNameVector.size(); j++){myContactList.append(contactNameVector.elementAt(j).toString(), null);
    }
    Pooja Goel
    Software Engineer
    CHD,India

  4. #4
    Registered User
    Join Date
    Oct 2006
    Posts
    28

    Re: JSR - 75 API problem

    Hi,

    I am not sure about this but I think the contact with no name may return an empty String when you call
    item.getString(Contact.FORMATTED_NAME, 0).

    You may try this:
    Code:
    ContactList list = (ContactList) pim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, listNameToOpen);
    Enumeration enumeration = list.items();
    
    while (enumeration.hasMoreElements())
    {
        Contact contact = (Contact) enumeration.nextElement();
    
        String contactName = "";
    
        if (list.isSupportedField(Contact.FORMATTED_NAME))
        {
            String formattedName = contact.getString(Contact.FORMATTED_NAME, 0);
    
            if (formattedName != null && !formattedName.equals(""))
            {
                contactName = formattedName;
            }
            else
            {
                contactName = "(Unnamed)";
            }
        }
        else
        {
            // in case list is not support field Contact.FORMATTED_NAME,
            // you may get contactName from field Contact.NAME 
            // or contactName = "(Unnamed)";
        }
        contactNameVector.addElement(contactName);
    }
    list.close();

  5. #5
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Thumbs up Re: JSR - 75 API problem

    Hello EveryOne!
    I want to share my latest R&D for this "unnamed" issue.
    That is if we retrieve the contacts with "Contact.TEL" format then it is showing the contact number of unnamed contacts also.
    Actually when we are retrieving it through Contact.FORMATTED_NAME format then it does not show them on real devices but with same code its working fine on DefaultColorPhone emulator by showing the name field length "0" for unnamed contacts.

    View code for same below....

    String listNameToOpen----
    -------
    for (Enumeration enumItems = list.items(); enumItems.hasMoreElements() {
    PIMItem item = (PIMItem) enumItems.nextElement();
    int codeName = Contact.FORMATTED_NAME;
    int codeTelName = Contact.TEL;
    //User defined function to retrieve contacts as per name
    getNameContact(item, codeName, codeTelName);
    //myContactList.append(contactNameVector.elementAt(i).toString(), null);
    int codeTel = Contact.TEL;
    if(((sName.trim().length() == 0) || sName.trim().equals(null)) ){ contactNameVector.addElement("(unnamed)");
    }else if((sName.length() > 0) || (!sName.trim().equals(null))){ contactNameVector.addElement(item.getString(codeName, 0));
    }
    }
    i++;
    }

    So please reply if anybody worked on "unnamed" contacts for JSR75 and know what they get stored in real devices.
    Pooja Goel
    Software Engineer
    CHD,India

  6. #6
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Red face Re: JSR - 75 API problem

    Thanks pom_cc for replying
    I implemented the code which u have written in ur post but not being able to view "unnamed" contacts in the real device, also faced an exception which is "Invalid index:0".
    Please also view my last post in which i mentiond the latest R&D results at my side. The main problem is to know the value which get stored in handsets in respect of "unnamed" as its not null, "" and not having length 0 and not even greater than 0. So please reply if any body have any idea related to it.
    Cheers!!
    Pooja Goel
    Software Engineer
    CHD,India

  7. #7
    Regular Contributor
    Join Date
    Sep 2006
    Location
    Delhi
    Posts
    77

    Re: JSR - 75 API problem

    Hi j2meDev,

    I worked on the "unnamed" contacts a long before . But now I don't remember.

    I remember that, In WTK my application was working all right for unnamed contacts. But In Nokia S60 emulator and in 6630 device I faced the same problem as yours.

    I think, instead of Contact.FORMATTED_NAME if you try Contact.Name it may work on real devices. But I am not sure. All the best.
    Last edited by sunil_talent; 2007-06-13 at 12:23.
    regards

    Sunil (sunilmnaik@gmail.com)

  8. #8
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Thumbs up Re: JSR - 75 API problem

    Hi Sunil_talent
    I m working with ur idea i.e to use Contact.NAME to show contacts. Still not being able to show unnamed contacts so its still under R&D process will post when will find out the final solution for this problem.
    If any one had faced the same issue then please reply. Unity can break a bigger stone.
    Thanks in advance
    Pooja Goel
    Software Engineer
    CHD,India

  9. #9
    Registered User
    Join Date
    Feb 2007
    Posts
    16

    Unhappy Re: JSR - 75 API problem

    Guys its still giving problem on real devices for unnamed contacts even with contact.NAME
    so please reply if any body have any idea
    Thanks alot
    Pooja Goel
    Software Engineer
    CHD,India

Similar Threads

  1. Jsr 180 - J2me Sip Api
    By sipshakers in forum Mobile Java General
    Replies: 3
    Last Post: 2010-04-27, 12:55
  2. Problem with Camera API (S60 2.0)
    By tpikkara in forum Symbian
    Replies: 20
    Last Post: 2008-05-26, 06:39
  3. Camera API problem
    By pmdr05 in forum Symbian
    Replies: 2
    Last Post: 2007-03-06, 11:15
  4. Location API (JSR 179) in Nokia Phones
    By mgruebsch in forum Mobile Java General
    Replies: 1
    Last Post: 2004-09-17, 04:50
  5. JSR 179 location API for Linux ?
    By carln672 in forum Mobile Java General
    Replies: 2
    Last Post: 2004-07-30, 10:21

Posting Permissions

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