Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Adding a contact in PIM API

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
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!