안드로이드 개발 질문/답변
(글 수 45,052)
현재
와 같이 주소록을 호출해서 선택하면
처럼 데이터를 받아올수 있습니다.
근데 받아온 데이터를 vcf 파일로 만드는 방법좀 알려주세요ㅠ
조언좀 부탁드리겠습니다.
갈피를 못잡겠어요ㅠ
intent = new Intent(Intent.ACTION_PICK); intent.setType(ContactsContract.CommonDataKinds.Phone.CONTENT_TYPE); startActivityForResult(intent, REQ_CONTACT_SELECT);
와 같이 주소록을 호출해서 선택하면
if( requestCode == REQ_CONTACT_SELECT && resultCode == RESULT_OK ){
String pNumber = ""; String name = ""; long id = 0; ContentResolver cr= getContentResolver(); Cursor cursor = managedQuery(dataUri, null, null, null, null);
while ( cursor.moveToNext() ){
pNumber = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.Phone.NUMBER));
name = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
id = cursor.getLong(cursor.getColumnIndexOrThrow(ContactsContract.Data.RAW_CONTACT_ID ));
}
itemdatamanager.tempItemPhoto = getContactPhoto(cr, id);
itemdatamanager.tempItemType = itemdatamanager.type[1];
itemdatamanager.tempItemTitle = name;
itemdatamanager.tempItemContents = pNumber;
if( !itemdatamanager.inputItem() ){
Util.toast(this, "더이상 아이템을 추가할 수 없습니다.");
}처럼 데이터를 받아올수 있습니다.
근데 받아온 데이터를 vcf 파일로 만드는 방법좀 알려주세요ㅠ
조언좀 부탁드리겠습니다.
갈피를 못잡겠어요ㅠ



