|
|
온라인에서 검색해 본 대부분의 코드에 오류가 있어서 무척고생했다.
에뮬레이터에서 임의로 전화번호를 추가한 후 다음의 코드는 정상적으로 동작하는 것을 확인할 수 있었다.
Code Snippets
String[] projection = new String[]{
People.NAME,
People.NUMBER
};
Cursor c = this.getContentResolver().query(Contacts.Phones.CONTENT_URI, projection, null, null, People.NAME + " ASC");
c.moveToFirst();
int nameCol = c.getColumnIndex(People.NAME);
int numCol = c.getColumnIndex(People.NUMBER);
do{
//Do something
String name = c.getString(nameCol);
String phoneNumber = c.getString(numCol);
// Toast.makeText(this, name+":"+phoneNumber, Toast.LENGTH_SHORT).show();
} while(c.moveToNext());
|
|
|
|
|
|
|
|
|
|
| 이전글 : 02) Intent를 이용한 공유기능 |
| 다음글 : 90. 참고사이트 |
|
목차보기
작가의서재
|
|
최근 수정일: 2010년 03월 09일 | 4번 수정됨
|
,
|
|
|
|
|