×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Feb 2007
    Posts
    5

    Problem in displaying available contacts in list

    Hello,

    I am trying to read contacts from all kinds of memory(i.e., SIM, Phone Memory) and want to display them as list for user to select desired contacts in my application. If a user has more contacts then it is taking so time to do all this process of reading and displaying them as a list for selection is there any optimized way of achieving this?

    Currently what I am doing is first fetching all the contacts from “PIM.CONTACT_LIST” into an enumeration and iterating it to create a list with selection option. I am doing this in a separate thread instead of my main thread, still it takes so much time for populating contacts in to list. Below is the sample code of what am doing:

    List lstContacts = numm;
    ContactList contactsList = null;
    int intContactStoredIn = 0;
    Enumeration enumContacts = null;
    int numTotalContacts = 0;

    this.objPim = PIM.getInstance();

    try {
    String[] memoryList = this.objPim.listPIMLists(PIM.CONTACT_LIST);

    for(int i=0; i<memoryList.length; i++) {
    contactsList = (ContactList)this.objPim.openPIMList(PIM.CONTACT_LIST, PIM.READ_ONLY, memoryList[i]);
    if( (memoryList[i].indexOf("SIM") != -1) || (memoryList[i].indexOf("UIM") != -1) || (memoryList[i].indexOf("CARD") != -1))
    intContactStoredIn = 1;

    enumContacts = contactsList.items();
    String strContactName = "";

    while(enumContacts.hasMoreElements()) {
    strContactName = "";
    Contact contact = (Contact)enumContacts.nextElement();
    contactsList.importContact(contact);

    if(contactsList.isSupportedField(contact.NAME_GIVEN))
    strContactName = contact.getString(contact.NAME_GIVEN, contact.ATTR_NONE);
    if(contactsList.isSupportedField(contact.NAME_FAMILY))
    strContactName += contact.getString(contact.NAME_FAMILY, contact.ATTR_NONE);
    if(contactsList.isSupportedField(contact.NAME_OTHER))
    strContactName += contact.getString(contact.NAME_OTHER, contact.ATTR_NONE);
    if(contactsList.isSupportedField(contact.FORMATTED_NAME))
    strContactName += contact.getString(contact.FORMATTED_NAME, contact.ATTR_NONE);

    if(contactsList.isSupportedField(contact.UID))

    lstContacts.append(strContactName, null);
    }
    }
    }
    catch(Exception ex) {
    System.out.println("Exception : " + ex);
    }


    Is there any optimize way of achieving it? Or is there any other alternate for displaying contacts with selectable option in my application?

    Regards

  2. #2
    Super Contributor
    Join Date
    Apr 2003
    Location
    USA, CA
    Posts
    7,191

    Re: Problem in displaying available contacts in list

    Not an answer to your question, but a related note. On S60 phones you cannot access the SIM card contacts, on Series 40 phones you can.

    And I'll let others to give you optimization tips (as I do not have any recommendations at this point)

    Hartti

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

    Re: Problem in displaying available contacts in list

    Thnx Hartti.. Hope some will provide an optimized solution for this.

Similar Threads

  1. List Box Problem
    By amitaggarwal in forum Symbian User Interface
    Replies: 47
    Last Post: 2012-03-02, 09:37
  2. Another Contacts problem
    By adenbeckitt in forum Symbian
    Replies: 1
    Last Post: 2008-04-15, 04:30
  3. Sending and SMS using the contacts list
    By paulaamills in forum Symbian Networking & Messaging (Closed)
    Replies: 0
    Last Post: 2006-04-01, 13:35
  4. Firmware bug or code bug displaying list on 3650
    By blackjack75 in forum Mobile Java General
    Replies: 2
    Last Post: 2003-09-24, 19:52
  5. setting list problem
    By ddhungry in forum Symbian
    Replies: 0
    Last Post: 1970-01-01, 02:00

Posting Permissions

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