Android examples for android.content:ContentResolver
query Phone from ContentResolver
//package com.java2s; import android.content.ContentResolver; import android.database.Cursor; import android.provider.ContactsContract.Data; import android.provider.ContactsContract.CommonDataKinds.Phone; public class Main { private static final String[] PROJECTION_PHONE = { Data._ID, Phone.NUMBER, Phone.TYPE, Phone.LABEL }; private static final String SELECTION_PHONE = Data.LOOKUP_KEY + "=?" + " AND " + Data.MIMETYPE + "='" + Phone.CONTENT_ITEM_TYPE + "'"; public static Cursor queryPhone(ContentResolver contentResolver, String lookupKey) {/* w w w . j av a 2 s.co m*/ String[] selectionArgs = { lookupKey }; return contentResolver.query(Data.CONTENT_URI, PROJECTION_PHONE, SELECTION_PHONE, selectionArgs, null); } }