×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Oct 2007
    Location
    Noida
    Posts
    152

    Retrieve Contact list application

    hello all Coders,
    I am tryin to retrive all the contact list from the phone in my midilet. there is a lot of code given in internet but dosent works for me. So i modified it for myself in the following manner ..

    ------------------------------------------------------

    public void Fill_phone()
    {
    String err = null;
    PIM p = PIM.getInstance();
    err = "line1";
    ContactList cl = null;
    err = "line2";
    Image img = new Ima


    {
    err = "line3";
    cl = (ContactList)p.openPIMList(PIM.CONTACT_LIST,PIM.READ_ONLY);
    err = "line4";
    // Enumeration en = cl.items();
    err = "line5";
    for(Enumeration enn = cl.items();enn.hasMoreElements()
    {err = "line6";
    String phno = null;
    err = "line7";
    Contact c = (Contact)enn.nextElement();
    err = "line8";
    int p_no = c.countValues(Contact.TEL);
    err = "line9";
    for(int i = 0;i<p_no;i++)
    {
    err = "line10";
    phno = c.getString( Contact.TEL,i);
    err = "line11";
    }
    list1.append(phno,null);
    err = "line12";
    }


    }
    catch(PIMException e)
    {
    stringItem1.setText(e.toString() + err);
    }
    }

    ---------------------------------------------------------------------------

    now i want to retrive the Names and am not able to do it . i have tried a bit but am not able to work it out . please help

    thanks in Advance

  2. #2
    Regular Contributor
    Join Date
    Sep 2007
    Location
    Thirunelveli
    Posts
    115

    Re: Retrieve Contact list application

    Hi ,
    You can get the names by:
    if (cl.isSupportedField(Contact.FORMATTED_NAME))
    c.getString(Contact.FORMATTED_NAME,0)
    if Contact.FORMATTED_NAME is not supported try with Contact.NAME. I am refering the variable mentioned in your code.

Similar Threads

  1. List Box application
    By techietintu in forum Symbian User Interface
    Replies: 10
    Last Post: 2007-04-03, 08:34
  2. how to get the installed application list ??
    By shadi.alalem in forum Symbian
    Replies: 3
    Last Post: 2007-02-26, 22:54
  3. how to show a list box in my application
    By bharats in forum Symbian User Interface
    Replies: 11
    Last Post: 2006-11-15, 11:34
  4. 6680 and bluetooth service profiles
    By ceruault in forum Mobile Java Networking & Messaging & Security
    Replies: 1
    Last Post: 2005-10-08, 22:24
  5. Contact list access
    By daverussell in forum Smart Messaging
    Replies: 0
    Last Post: 2002-12-12, 19:22

Posting Permissions

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