Android Contact Search isContactNameByNumberExist(Context context, String number)

Here you can find the source of isContactNameByNumberExist(Context context, String number)

Description

judge qrcodecontacts exist by name

Parameter

Parameter Description
context a parameter
number a parameter

Declaration

public static boolean isContactNameByNumberExist(Context context,
        String number) 

Method Source Code

import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract;
import com.android.qrcodecontact.entity.QRCodeContact;
import java.io.File;

public class Main{
    /**//from w  w  w.jav a  2  s. c o  m
     * judge qrcodecontacts exist by name
     * @param context
     * @param number
     * @return
     */
    public static boolean isContactNameByNumberExist(Context context,
            String number) {
        Uri uri = Uri
                .parse("content://com.android.contacts/data/phones/filter/"
                        + number);
        ContentResolver resolver = context.getContentResolver();
        Cursor cursor = resolver.query(uri,
                new String[] { "display_name" }, null, null, null);
        return cursor.moveToFirst();
    }
}

Related

  1. processContactsResult(Activity activity, Intent intent)