I try the following code to remove contact with a specified number:
private void removeContact(Context context, String phone) { //context.getContentResol
Do you have the appropriate permissions declared in your manifest?
You'll need the android.permission.READ_CONTACTS and android.permission.WRITE_CONTACTS uses-permission tags before Android will let you mess with the contacts provider:
android.permission.READ_CONTACTS
android.permission.WRITE_CONTACTS