Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import multiple .vcf file programmatically in android?

I have multiple vcf files in my sdcard. I want import those vcf files into my contacts.

I am using the below code :

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

By using above code i can unable to import one vcf file at a time. I want to import multiple vcf files at a time. By using above code i am getting duplicate contacts also.

Is there any other efficient way to import contacts except intent ? Thank you.

like image 975
Siri Avatar asked Apr 16 '15 04:04

Siri


1 Answers

Use Intent.ACTION_PICK instead of Intent.ACTION_VIEW

like image 66
Naren Avatar answered Sep 20 '22 10:09

Naren