How to read contacts on Android 2.0

First, ensure that you have added <uses-permission android:name=”android.permission.READ_CONTACTS”/> to your AndroidManifest.xml file, then you can loop through your phone contacts like this: Cursor cursor = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,null, null, null, null); while (cursor.moveToNext()) { String contactId = cursor.getString(cursor.getColumnIndex( ContactsContract.Contacts._ID)); String hasPhone = cursor.getString(cursor.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER)); if (Boolean.parseBoolean(hasPhone)) { // You know it has a number so now query it … Read more

How to call Android contacts list?

I’m not 100% sure what your sample code is supposed to do, but the following snippet should help you ‘call the contacts list function, pick a contact, then return to [your] app with the contact’s name’. There are three steps to this process. 1. Permissions Add a permission to read contacts data to your application … Read more