Android Question Delete A Contact

MODERN TALKING

Active Member
Licensed User
Longtime User
Hi Erel,

Tried my level best to use your ContactsUtils Library to DELETE A CONTACT but just can't seem to make it work

Tried Filippo's fgContacts Library too - but to no avail either

Please can guide me in the right direction

Thank you,

"Goldielocks" Goldman
 

MODERN TALKING

Active Member
Licensed User
Longtime User
Can't remember o_O

I used ContactUtils.DeleteAllContacts - didn't work

I try ContactUtils.DeleteContact and if works for one then I Loop it for all

Thank you Erel - tell you tomorrow or Thursday
 
Upvote 0

MODERN TALKING

Active Member
Licensed User
Longtime User
Hi Erel,

ContactsUtils.DeleteContact doesn't work for me

Weird - maybe I'm not "calling" properly

Can you help me by posting a short code to do this:

Delete contact ID = 3

Maybe the way I'm writing the command is not correct

THANK YOU Erel :)
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This code works here:
B4X:
Sub Activity_Create(FirstTime As Boolean)
   If FirstTime Then
     cu.Initialize
   End If
   Activity.LoadLayout("1")
   runtime.CheckAndRequest(runtime.PERMISSION_WRITE_CONTACTS)
End Sub

Sub Activity_PermissionResult (Permission As String, Result As Boolean)
   If Result Then
     DeleteContacts("[email protected]")
     DeleteContacts("[email protected]") 'should show 0 matches
   End If
End Sub

Sub DeleteContacts(mail As String)
   Dim contacts As List = cu.FindContactsByMail(mail, True, False)
   Log("Matches: " & contacts.Size)
   For Each c As cuContact In contacts
     Log(c.DisplayName)
     Log(c.Id)
     cu.DeleteContact(c.Id)       
   Next
End Sub
 
Upvote 0

MODERN TALKING

Active Member
Licensed User
Longtime User
INCREDIBLE EREL - thank you so much, again

You are the ABSOLUTE BEST and we love you :)

Have you thought about a Crowdfunding Project - to take B4X to the next level - but it's already the MOST FANTASTIC IN THE WORLD

Or develop something else you always wanted to?

Everyone here will contribute FOR SURE
 
Upvote 0
Top