일부분 소스입니다.


@Override

public void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

setContentView(R.layout.endsms);


Cursor cursor = getURI(); // 전화번호부 가져오기


int end = cursor.getCount(); // 전화번호부의 갯수 세기


String name [] = new String[end]; // 전화번호부의 이름을 저장할 배열 선언

int count = 0;


if(cursor.moveToFirst()) 

{

// 컬럼명으로 컬럼 인덱스 찾기 

int idIndex = cursor.getColumnIndex("_id");


do 

{

// 요소값 얻기

int id = cursor.getInt(idIndex);

name[count] = cursor.getString(1);


count++;

} while(cursor.moveToNext() || count > end);

}

setLayout();


mCountBt.setText("현재 체크된 숫자는 = 0 개 입니다.");

// ArrayList에 String으로 이루어진 값들을 Add 한다.

for(int i =0 ; i<=name[i].length(); i++){

mArrayList.add(name[i]);

}


mCustomAdapter = new CustomAdapter(AdNote_sms.this , mArrayList);

mListView.setAdapter(mCustomAdapter);

mListView.setOnItemClickListener(mItemClickListener);

}


private Cursor getURI() 

{

// 주소록 URI

Uri people = Contacts.CONTENT_URI;

// 검색할 컬럼 정하기

String[] projection = new String[] { Contacts._ID, Contacts.DISPLAY_NAME, Contacts.HAS_PHONE_NUMBER };

// 쿼리 날려서 커서 얻기

String[] selectionArgs = null;

String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";


return managedQuery(people, projection, null, selectionArgs, sortOrder);

}



현재 소스는 잘 작동 됩니다.


주소록을 가져오는데요.  빨간색부분 포문에 5번밖에 돌지 않습니다...ㅠㅠ


디버그로 확인한 결과


name[end] 안에는 556개의 이름이 들어가있는데요.


왜 5번밖에 돌지 못하는지 알고싶습니다. 도와주세요 ㅠㅠ


정말 쑥쓰럽군요 ㅠ