views:

22

answers:

1

This might be a really simple answer but I cant seem to come up with an answer for it, I'm aiming for android 2.1.

Any help would be great :-)

A: 

Try this within your Activity or other application component:

ContentResolver cr = getContentResolver();
Cursor cur = cr.query(People.CONTENT_URI, null, null, null, null);
if (cur.getCount() > 0) {
        while (cur.moveToNext()) {
                String name = formatName(cur.getString(cur
                                .getColumnIndex(People.DISPLAY_NAME)));
                // Do something with name.
        }
}
Andy Zhang