有人可以提供代码从SD卡导入联系人到Android手机。 我正在调查这个链接: Export the Contacts as VCF file 然而,它恰好与我想要的相反。请帮忙。
答案 0 :(得分:0)
要导入联系人,您只需要调用内置的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
}
}
}