I was following these links to get the contacts in my application
How to call Android contacts list?
http://www.higherpass.com/Android/Tutorials/Working-Wit
Try the code below:
ContentResolver contactResolver = getContentResolver();
Cursor cursor = contactResolver.query(Phone.CONTENT_URI, null, Phone.DISPLAY_NAME + "=?", new String[]{contactName}, null);
if(cursor.getCount() > 0){
cursor.moveToFirst();
do {
String number = cursor.getString(cursor.getColumnIndex(Phone.NUMBER));
}while (cursor.moveToNext() );
}