如何在android中以编程方式导入多个.vcf文件?

Sir*_*iri 9 android vcf-vcard vcf android-intent android-contacts

我的SD卡中有多个vcf文件.我想将这些vcf文件导入我的联系人.

我使用以下代码:

File file = new File(storage_path);
        Intent intent = new Intent(Intent.ACTION_VIEW);
        intent.setDataAndType(Uri.fromFile(file), "text/x-vcard");
        startActivity(intent);
Run Code Online (Sandbox Code Playgroud)

通过使用上面的代码,我无法一次导入一个vcf文件.我想一次导入多个vcf文件.通过使用上面的代码我也得到重复的联系人.

除了意图之外,还有其他有效的方法来导入联系人吗?谢谢.

小智 1

使用Intent.ACTION_PICK而不是 Intent.ACTION_VIEW