How to import or insert contacts from .vcf file in Android programmatically?

后端 未结 1 1751
误落风尘
误落风尘 2021-01-13 13:18

I create .vcf file of all contacts in Android using below code.

public static void getVCF() 
{
    final String vfile = \"POContactsRestore.vcf\         


        
1条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2021-01-13 13:28

    Actually I also want to do the same and a after a long research finally i got the solution.

    Here is the piece of code to restore:

    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.setDataAndType(Uri.fromFile(new File(storage_path+vfile)),"text/x-vcard"); //storage path is path of your vcf file and vFile is name of that file.
    startActivity(intent);
    

    Enjoy!!

    0 讨论(0)
提交回复
热议问题