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


Reply With Quote

