我在从我的联系人列表中获取联系人时遇到问题。我正在使用这段代码:
final Cursor Contact = cResolver.query(ContactsContract.Contacts.CONTENT_URI, null,
ContactsContract.Contacts._ID +" = " + Contact_ID, null,null);
Contact.moveToFirst();
String lookupKey = Contact.getString(Contact
.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(
ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
AssetFileDescriptor fd = null;
FileInputStream fis = null;
fd = cResolver.openAssetFileDescriptor(uri, "_ID");
fis = fd.createInputStream();
byte[] buf = new byte[(int) fd.getDeclaredLength()];
fis.read(buf);
String vcardstring = new String(buf);
但我得到Exception
:
java.io.IOException: read failed: EINVAL (Invalid argument)
libcore.io.IoBridge.read(IoBridge.java:432)
谁能帮我这个?