judge qrcode contacts exist by name - Android Account

Android examples for Account:Contact Name

Description

judge qrcode contacts exist by name

Demo 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   ww w  .j  a  v  a2 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 Tutorials