How to remove a contact programmatically in android

前端 未结 7 1341
梦毁少年i
梦毁少年i 2020-11-28 08:49

I try the following code to remove contact with a specified number:

private void removeContact(Context context, String phone) {
    //context.getContentResol         


        
7条回答
  •  栀梦
    栀梦 (楼主)
    2020-11-28 09:17

    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:

    
    
      
      
    
    
    

提交回复
热议问题