아래의코드를 두군데에서 사용했는데

한군데는 정상동작하고

다른한군데에서는 런타임시 에러가납니다

코드를 살펴보면 에러가나야정상일것같은데

에러가안나는경우는 왜인지 모르겠내여

타입이 스트링인경우와 int 형 long 형 등의 타입들이 있는데

rawContacts.getString(pos)

이렇게 루프를돌면서 필드구분없이 스트링값을구하려구하면 에러가나야되지않나요?

필드타입별로 값을 구하려면...


       buf = new StringBuffer();
        rawContacts = mCtx.getContentResolver().query(RawContacts.CONTENT_URI,
                new String[] {
                    RawContacts._ID, RawContacts.ACCOUNT_NAME,
                    RawContacts.ACCOUNT_TYPE,
                    RawContacts.AGGREGATION_MODE, RawContacts.CONTACT_ID,
                    RawContacts.CUSTOM_RINGTONE,
                    RawContacts.DELETED, RawContacts.DIRTY,
                    RawContacts.LAST_TIME_CONTACTED,
                    RawContacts.SEND_TO_VOICEMAIL, RawContacts.SOURCE_ID,
                    RawContacts.STARRED,
                    RawContacts.SYNC1, RawContacts.SYNC2, RawContacts.SYNC3,
                    RawContacts.SYNC4, RawContacts.TIMES_CONTACTED,
                    RawContacts.VERSION
                    },
                null,
                null,
                null);

        rawContacts.moveToFirst();
        if (!rawContacts.isAfterLast()) {
            do {
                rawContactID = rawContacts.getLong(0);
                buf.append("--- RawContacts Lists ---\n");
                for (int pos = 0;pos < rawContacts.getColumnCount();pos++) {
                    if (rawContacts.getString(pos) != null) {
                        buf.append(rawContacts.getColumnName(pos).toUpperCase()
                           + ": " + rawContacts.getString(pos) + "\n");
                    }
                }
                buf.append("\n");
            } while (rawContacts.moveToNext());
        }
        rawContacts.close();