Well, I have successfully developed the Contacts application for Android as my main project. I find it pretty simple. Here is the code how I did it.
Cursor c = getContentResolver().query(ContactsContract.Contacts.CONTENT_URI,
null,
ContactsContract.Contacts.HAS_PHONE_NUMBER + " = 1",
null,
ContactsContract.Contacts.DISPLAY_NAME+" COLLATE LOCALIZED ASC");
mAdapter = new MyAdapter(this,
R.layout.single_cell,
c,
new String[]{ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME},
new int[]{R.id.disp_name},
CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER);
listview.setAdapter(mAdapter);
And, in MyAdapter, I expanded SimpleCursorAdapter and moved bindView () to take advantage of the effectiveness of SimpleCursorAdapter. However, you need to get permission to read contacts. In the manifest file. Please, indicate,
<uses-permission android:name="android.permission.READ_CONTACTS"/>
Hope this helps.
source
share