vcard

是将联系人导出程vcard格式吧?
获取联系人代码如下:
Java code
         
         
         
         
private ArrayList < String > contactName = new ArrayList < String > ();
         
         
         
         
private ArrayList < String > contactNumber = new ArrayList < String > (); private void getPhoneContacts(){
         
         
         
         
ContentResolver resolver = this .getContentResolver();
         
         
         
         
Cursor cursor = resolver.query(Phone.CONTENT_URI, PHONES_PROJECTION, null , null , null );
         
         
         
         
if (cursor != null ){
         
         
         
         
while (cursor.moveToNext()){
         
         
         
         
String ctNumber = cursor.getString(PHONES_NUMBER_INDEX);
         
         
         
         
if (TextUtils.isEmpty(ctNumber)){
         
         
         
         
continue ;
         
         
         
         
}
         
         
         
         
String ctName = cursor.getString(PHONES_DISPLAY_NAME_INDEX);
         
         
         
         
contactName.add(ctName);
         
         
         
         
contactNumber.add(ctNumber);
         
         
         
         
}
         
         
         
         
cursor.close();
         
         
         
         
}
         
         
         
         
}
         
         
         
         
 

以上只是获取部分数据,其余同理。将获取的数据组织程vcard格式文件就行了。

你可能感兴趣的:(java,String,null)