×

Discussion Board

Results 1 to 4 of 4
  1. #1
    Registered User
    Join Date
    Apr 2006
    Posts
    13

    Enumarating contact list

    Hi all,
    I am facing problem with contact list.
    The problem is that i have created a application in which i read all the contact in the phone. if the contact list is small i.e. upto 20 no. it works fine. But if the no. of contact is more, then it goes to heap memory, since i have to load all the contact to display.
    The solution for these can be, load 10 contact at a time and during the down key press after reaching the 10th contact reload the next 10 contact. And during Up key press vice-versa.
    But i don't find solution for these enumation, as each time the enumation starts from first and i don't find any method where i can specify the start point of enumation. so can any help me for these? or do any one have some other alternative method. if yes then please let me know.
    Here is the sample code i am using

    String conListName[] = PIM.getInstance().listPIMLists(PIM.CONTACT_LIST);

    ContactList contacts = (ContactList) (PIM.getInstance().openPIMList(PIM.
    CONTACT_LIST, PIM.READ_WRITE, conListName[0]));

    Enumeration e = contacts.items();

    while (e.hasMoreElements())
    {
    Contact cc = (Contact) e.nextElement();
    if (cc.countValues(Contact.TEL) > 0)
    {
    contactList.addElement(cc);
    }
    }



    Regards
    shagish.k

  2. #2
    Super Contributor
    Join Date
    Dec 2005
    Location
    Europe/Poland/Warsaw
    Posts
    1,697

    Re: Enumarating contact list

    hi shagish,

    just wondered something,
    Contact should have assigned UID according to specs, at least while reading them,

    Enumeration e = contacts.items();
    int currentID;
    while(e.hasMoreElements()){
    Contact c = (Contact) e.nextElement();
    currentID = Integer.parseInt(c.getString(Contact.UID, 0));
    System.out.println("UID of contact: "+currentID);
    }

    can we first get just first 10 items, put them into new vector or hashmap and then reuse if required? (that is if a uid is in hasmap already get item from hashmap, otherwise enumerate egain using only items that UID is greater then last one? (at least in emulator UID comes in sorted order, not sure about real device),

    related post (unanswered):
    http://discussion.forum.nokia.com/fo...ht=ContactList

    regards,
    Peter

  3. #3
    Regular Contributor
    Join Date
    Mar 2003
    Posts
    170

    Re: Enumarating contact list

    What phone are you targeting?

  4. #4
    Registered User
    Join Date
    Apr 2006
    Posts
    13

    Re: Enumarating contact list

    Quote Originally Posted by peterblazejewicz
    hi shagish,

    just wondered something,
    Contact should have assigned UID according to specs, at least while reading them,

    Enumeration e = contacts.items();
    int currentID;
    while(e.hasMoreElements()){
    Contact c = (Contact) e.nextElement();
    currentID = Integer.parseInt(c.getString(Contact.UID, 0));
    System.out.println("UID of contact: "+currentID);
    }

    can we first get just first 10 items, put them into new vector or hashmap and then reuse if required? (that is if a uid is in hasmap already get item from hashmap, otherwise enumerate egain using only items that UID is greater then last one? (at least in emulator UID comes in sorted order, not sure about real device),

    related post (unanswered):
    http://discussion.forum.nokia.com/fo...ht=ContactList

    regards,
    Peter
    hi Peter,
    I think u r not getting my problem. the problem is the enumaration and heap size. if i use enumaration i have to store all the contact for use which results in heap issue as the no. of contact goes on increasing.
    i just want to know is there a solution through which i can extract contact from certain range of values. i.e. assume from 0 - 10, 10 - 20,..
    Or is there a better solution than enumarating the contact list.

    Regards,
    shagish.k

Similar Threads

  1. J2ME and contact list
    By morphine_titan in forum Mobile Java General
    Replies: 7
    Last Post: 2009-01-06, 07:49
  2. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  3. 6010 and contact list
    By buzlink in forum General Development Questions
    Replies: 0
    Last Post: 2005-01-11, 18:14
  4. Contact list access
    By daverussell in forum Smart Messaging
    Replies: 0
    Last Post: 2002-12-12, 19:22
  5. Showing and accesing contact list library
    By djorge in forum Symbian User Interface
    Replies: 1
    Last Post: 2002-09-25, 11:01

Posting Permissions

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