Can someone provide me the code to import contacts from sdcard to android phone.? I was looking into this link: Export the Contacts as VCF file however, its just the opposite of what i want. Please help.
Asked
Active
Viewed 825 times
1 Answers
0
In order to Import Contacts you just need to call inbuilt Intent of Android ....
private void restoreContact(){
if(android.os.Build.VERSION.SDK_INT < 11){
try{
Intent i = new Intent();
i.setComponent(new ComponentName("com.android.contacts","com.android.contacts.ImportVCardActivity"));
startActivity(i);
} catch(Exception e){
try {
Intent i = new Intent();
i.setComponent(new ComponentName("com.sonyericsson.contacts","com.sonyericsson.contacts.contactlist.ImportVCardActivity"));
startActivity(i);
}
catch (Exception ex)
{
//Show Exception
}
}
} else if(android.os.Build.VERSION.SDK_INT >= 11){
try{
Intent intent =new Intent();
intent.setComponent(new ComponentName("com.android.contacts","com.android.contacts.vcard.ImportVCardActivity"));
startActivity(intent);
}catch(Exception e){
//Show Exception
}
}
}

FreelancerDev
- 16
- 2