Manish Khot
Manish Khot

Reputation: 3037

Android contatcs vcard API

Is there any android API to extract contacts in vcard 3.0 format ? I have come across an open-source vcard project android-vcard

but in the usage Example the following comments are mentioned.

Important: If you are developing application for Android device, you don't have to use this library, because it is already included in the underlying Android framework. This library is useful only if you are developing application to be run outside of Android environment. Android developers: read this text twice.

Can you please let me know which library is mentioned in the above description? Is it made available to the application developers?

Upvotes: 3

Views: 4547

Answers (1)

Schildmeijer
Schildmeijer

Reputation: 20946

This works with Eclair (>= Android 2.0) and I guess its somewhat this functionality the examples page describes

Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
AssetFileDescriptor fd = resolver.openAssetFileDescriptor(uri, "r");
FileInputStream fis = fd.createInputStream();
byte[] b = new byte[(int)fd.getDeclaredLength()];
fis.read(b);
String vCard = new String(b);
sb.append(vCard);

Upvotes: 5

Related Questions