开发者

Import/Export to VCard format programmatically using android OS 2.0 API level 5

开发者 https://www.devze.com 2022-12-11 09:32 出处:网络
The Android 2.0 SDK has a import/ex开发者_如何学JAVAport option to export or import contacts in VCard format.

The Android 2.0 SDK has a import/ex开发者_如何学JAVAport option to export or import contacts in VCard format.

Is there any API to achieve this functionality.


Try such code for export to VCard:

Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
AssetFileDescriptor fd = contentResolver.openAssetFileDescriptor(uri, "r");
FileInputStream fis = fd.createInputStream();
byte[] buf = new byte[(int)fd.getDeclaredLength()];
if (0 < fis.read(buf))
{
   String vCard = new String(buf);
}
0

精彩评论

暂无评论...
验证码 换一张
取 消