In Android 7, ContentResolver's method-openAssetFileDescriptor(vCardUri, “r”) returns AssetFileDescriptor having declaredLength as -1
问题 In Android 7, getContentResolver().openAssetFileDescriptor(vCardUri, "r") returns AssetFileDescriptor having declaredLength as -1 returned by getDeclaredLength() . Trying to export the contacts as vcards into vcf file. The code I have tried is as follows 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