final String[] projection = new String[] {
Phone.NUMBER,
Phone.TYPE,
};
final Cursor phone = mCtx.getContentResolver().query(
Phone.CONTENT_URI,
projection,
Data.CONTACT_ID + "=?",
new String[]{String.valueOf(contactId)},
null);
int count = phone.getColumnCount();
String[] strArr = new String[count];
if(phone.moveToFirst()) {
int contactNumberColumnIndex = phone.getColumnIndex(Phone.NUMBER);
int contactTypeColumnIndex = phone.getColumnIndex(Phone.TYPE);
int i = 0;
while(!phone.isAfterLast()) {
String number = phone.getString(contactNumberColumnIndex);
int type = phone.getInt(contactTypeColumnIndex);
strArr[i] = number;
i++;
phone.moveToNext();
}
}
위코드는 주소록의 전화번호 구하는코드인데
에러가 있습니다
int count = phone.getColumnCount();
전화번호 갯수구하는부분인데
실제 해당 아이디에대한 전화번호가 3개가 저장되어있는데
count 값이 2 로 나옵니다
그래서 배열갯수가 잘못셋팅되어 에러가 납니다
이거 왜 이런걸까요?
어떻게해결해야될런지...
조언부탁합니다