This week's book giveaway is in the HTML, CSS and JavaScript forum.
We're giving away four copies of hapi.js in Action and have Matt Harrison on-line!
See this thread for details.
Win a copy of hapi.js in Action this week in the HTML, CSS and JavaScript 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
Boost this thread!