Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/193.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
正在将Contact.VCF导入phonebook android_Android_Android Intent_Contacts_Android Contacts_Start Activity - Fatal编程技术网

正在将Contact.VCF导入phonebook android

正在将Contact.VCF导入phonebook android,android,android-intent,contacts,android-contacts,start-activity,Android,Android Intent,Contacts,Android Contacts,Start Activity,我正在创建一个应用程序,在该应用程序中,我需要以编程方式将联系人备份到我的网站或从我的网站恢复联系人 这里我已经完成了一部分(备份联系人) 在另一部分(导入联系人)中,我使用此代码 Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(Environment.getExternalStorageDirectory()+File.separator+"Conta

我正在创建一个应用程序,在该应用程序中,我需要以编程方式将联系人备份到我的网站或从我的网站恢复联系人

这里我已经完成了一部分(备份联系人)

在另一部分(导入联系人)中,我使用此代码

Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new     File(Environment.getExternalStorageDirectory()+File.separator+"Contacts.vcf")),"text/x-vcard"); //storage path is path of your vcf file and vFile is name of that file.
startActivity(intent);
这段代码90%工作正常,唯一的问题是,当调用这段代码时,会显示一个警报对话框,我们必须手动选择恢复联系人的位置

e、 g电话、电子邮件id


如何使其自动调用,以便在调用此代码时,联系人自动恢复到手机内存中?

您可以通过类插入或导入联系人。

这似乎很好,但如何解析.vcf文件,以便从中插入联系人?