Just copy and pest following code use this function.
private void populateContactList() {
// Build adapter with contact entries
cursor = getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
new String[] { BaseColumns._ID, Phone.DISPLAY_NAME,Phone.NUMBER }, null, null, null);
startManagingCursor(cursor);
String[] from = new String[] { Phone.DISPLAY_NAME, Phone.NUMBER };
int[] to = new int[] { R.id.tv_name, R.id.tv_contact };
SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
R.layout.phone_listview, cursor, from, to);
your_list_view.setAdapter(adapter);
}
No comments:
Post a Comment