0

is there any method to compare given string with names in address book of android like using ContactsContract?

Jim
  • 1

1 Answers1

0

for the u need to compare the string to the each contact list list and set this name in one of the collection like listArray . here is the code from that u can fetch the contact list name

Cursor cursor = getContentResolver().query(
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                new String[] { Phone._ID, Phone.DISPLAY_NAME, Phone.NUMBER },
                null, null, null);

    /*  Cursor cursor = getContentResolver().query(
                ContactsContract.CommonDataKinds.Phone.CONTENT_URI,
                null,
                null, null, null);*/
        startManagingCursor(cursor);
        cursor.moveToFirst();
        cursor.getColumnCount();
//      //          Log.i("CURSOR COLUMN IS ", ""+cursor.getColumnCount());
        for (int i = 0; i < cursor.getCount(); i++) {
            contactName.add(cursor.getString(1));
        //  //        //          Log.i("NAME OF LIST CONTACT", "" + cursor.getString(3));
            cursor.moveToNext();
        }
dharmendra
  • 7,835
  • 5
  • 38
  • 71