Android的contatcs电子名片API电子名片、Android、contatcs、API

2023-09-06 04:39:58 作者:Transparent 透明

有没有Android的API来提取的vCard 3.0格式的联系人? 我所遇到的一个开放源代码的电子名片的项目 Android的电子名片

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

但在的用法示例以下意见被提及。

重要提示:如果您正在开发的应用程序的Andr​​oid设备,你不必再使用这个库,因为它已经包含在基本的Andr​​oid框架。这个库只有当你正在开发的应用程序是Android的环境外部运行非常有用。 Android开发者:读了这篇课文的两倍。

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?

推荐答案

这适用于巧克力慕斯蛋糕(> = Android 2.0的),我猜它有点此功能的示例页面描述

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);