Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.database.Cursor; import android.net.Uri; import android.provider.ContactsContract; public class Main { /** * @param mContext * @param number * @return sunrise.l String 2012-5-28 */ public static String getNameFormNumber(Context mContext, String number) { String name = null; Uri uri = Uri.withAppendedPath(ContactsContract.PhoneLookup.CONTENT_FILTER_URI, number); Cursor cur = mContext.getContentResolver().query(uri, new String[] { ContactsContract.PhoneLookup.DISPLAY_NAME }, null, null, null); if (cur != null && cur.moveToFirst()) { int nameIndex = cur.getColumnIndex(ContactsContract.PhoneLookup.DISPLAY_NAME); name = cur.getString(nameIndex); } cur.close(); return name; } }