[android-developers] Re: Import Contacts from .vcf file in Android 2.1
Hi there. Was there any solution for this? 'Cause I have a same problem. On Friday, November 26, 2010 9:11:40 AM UTC+4, Prateek Jain wrote: 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 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Import Contacts from .vcf file in Android 2.1
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. Please try to use search engines to find what you need before asking. A Google search took 5 seconds: http://en.wikipedia.org/wiki/VCard It lists the applicable RFC files. And the same question asked by the OP at the same time on StackOverflow: http://stackoverflow.com/questions/4144193/import-contacts-from-vcf-file-in-android-2-1 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
Re: [android-developers] Re: Import Contacts from .vcf file in Android 2.1
juzz go through this link http://eagle.phys.utk.edu/guidry/android/readContacts.html -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Import Contacts from .vcf file in Android 2.1
Afaik there is no standard way to insert contacts from a vcf file into the contacts provider. The entire package that deals with vCards, android.pim.vcard is hidden in the SDK and not available unless you're a big fan of abusing Java Reflection - in short, you should lift the parser from the android source tree and package it in your app. If you want to browse the code it uses for serializing and parsing vCards (both 2.1 and 3.0) it's available here. http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/android/pim/vcard/ On 26 Nov, 06:11, Prateek Jain mrprateekj...@gmail.com wrote: 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 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en
[android-developers] Re: Import Contacts from .vcf file in Android 2.1
Thanks Jens for the reply. I am afraid why Android has kept the import contacts api hidden though to export contacts in vcf format is available. I think I have to go hard way by packaging android source code in the app until I find a better solution for this. Thanks, Prateek On Nov 28, 8:03 pm, Jens dunkingbikk...@gmail.com wrote: Afaik there is no standard way to insert contacts from a vcf file into the contacts provider. The entire package that deals with vCards, android.pim.vcard is hidden in the SDK and not available unless you're a big fan of abusing Java Reflection - in short, you should lift the parser from the android source tree and package it in your app. If you want to browse the code it uses for serializing and parsing vCards (both 2.1 and 3.0) it's available here.http://www.google.com/codesearch/p?hl=en#uX1GffpyOZk/core/java/androi... On 26 Nov, 06:11, Prateek Jain mrprateekj...@gmail.com wrote: 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 -- You received this message because you are subscribed to the Google Groups Android Developers group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en