Android Question ContactsUtils

Sergey_New

Well-Known Member
Licensed User
Longtime User
Is it possible to get surname and name separately and not DisplayName?
 
Solution
For that one, use method 'GetAllContactsThunderbird'; it returns a list of types 'cuContactDetailsThunderbird', which contains those details and more :)

Sergey_New

Well-Known Member
Licensed User
Longtime User
method 'GetAllContactsThunderbird'
I can't get the following values:
B4X:
Sub FillContacts
    Dim wmCU As wmContactsUtils
    wmCU.Initialize
    Dim firstName, lastName, displayName As String
    For Each c As cuContact In wmCU.GetAllContactsThunderbird(True)
'        displayName=?
'        firstName=?
'        lastName=?
    Next
End Sub
 
Upvote 0

Sergey_New

Well-Known Member
Licensed User
Longtime User
Made:
B4X:
Sub FillContacts
    Dim wmCU As wmContactsUtils
    wmCU.Initialize
    Dim firstName, lastName, displayName As String
    For Each cd As cuContactDetailsThunderbird In wmCU.GetAllContactsThunderbird(True)
        displayName=cd.displayName
        lastName=cd.lastName
        firstName=cd.firstName
    Next
End Sub
 
Upvote 0

walt61

Active Member
Licensed User
Longtime User
Indeed, that one takes long. This way it's much faster (it doesn't pick up all the details, only the name fields):
B4X:
Sub FillContacts

    Dim wmCU As wmContactsUtils
    wmCU.Initialize
    Dim firstName, lastName, displayName As String
    For Each cd As cuContact In wmCU.FindAllContacts(True)
        Dim name As cuContactName = wmCU.GetDetailedName(cd.Id)
        displayName=cd.displayName
        lastName=name.FamilyName
        firstName=name.GivenName
    Next

End Sub
 
Upvote 0
Top