writing multiple vcards in the same plain-text file

47 views
Skip to first unread message

hervé frantz

unread,
Aug 22, 2013, 7:55:47 AM8/22/13
to ez-vcard...@googlegroups.com
HI to everyone,
very proud to be here with other ez-vcard user and i think this a great products.
ok that's my problem: i'am using ez-vcardfor an android project and i will want to know how to write multiple vcard in the same file; because it seems like when you wrote a vcard using this for example in a file it replace the vcard previously stored. Does the library automatically append a new vcard to existing one or should it do this explicitely. The code i use to write a new vcard in file is this: Ezvcard.write(vcard).version(VCardVersion.V4_0).go(vcfFile)

So any suggestions??

thanks in advance.

Michael Angstadt

unread,
Aug 22, 2013, 9:27:00 AM8/22/13
to ez-vcard...@googlegroups.com
The "Ezvcard" class cannot append onto existing files.  You will need to use the "VCardWriter" class instead:

Writer writer = new FileWriter(vcfFile, true);
VCardWriter vcardWriter = new VCardWriter(writer, VCardVersion.V4_0);
vcardWriter.write(vcard);
vcardWriter.close();

-Mike
Reply all
Reply to author
Forward
0 new messages