Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a contact in PIM API  RSS feed

Smitesh Patel
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 )
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];

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


byte b is the array of VCARD data
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!