Here you can find the source of isContactNameByNumberExist(Context context, String number)
Parameter | Description |
---|---|
context | a parameter |
number | a parameter |
public static boolean isContactNameByNumberExist(Context context, String number)
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(); } }