Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding a contact in PIM API

 
Smitesh Patel
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello ,

I want to add the contact in the ContactList using ContactList.importContact(contact) method .I know how to add usign the addString method of the Contact class .So pls inform me abt the use of importContact() method.





public void storeContact(byte[] b )
{
try
{
ContactList cList = (ContactList)PIM.getInstance().openPIMList(listType, PIM.WRITE_ONLY);
Contact contact = cList.createContact();
PIMItem[] item = new PIMItem[1];
ByteArrayInputStream bContact = new ByteArrayInputStream(b);
item = PIM.getInstance().fromSerialFormat(bContact,"UTF-8");
// String st = item[0].getString(Contact.REVISION,0);
// System.out.println(st);

contact = (Contact)item[0];
cList.importContact(contact);





}
catch(Exception e)
{
System.out.println("End of String"+e.toString());
}

}

byte b is the array of VCARD data
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic