Import Contacts from .vcf file in Android 2.1
- by Prateek Jain
Hi All,
I am able to retrieve all contacts from android in .vcf file using following code.
ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null);
String lookupKey = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.LOOKUP_KEY));
Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_VCARD_URI, lookupKey);
System.out.println("The value is " + cr.getType(uri));
AssetFileDescriptor fd = this.getContentResolver().openAssetFileDescriptor(uri, "r");
FileInputStream fis = fd.createInputStream();
I don't know how to use this .vcf file to import all these contacts using code. The .vcf file contains all the details of all contacts including photos etc.
Cheers,
Prateek