Hi,
I need to get the phone number of a contact.
I use wmContactsUtils version 1.2 by @walt61 from here: wmContactsUtils
I use this code:
B4X:
Private cu As wmContactsUtils
cu.Initialize
Dim lst As List = cu.FindContactsByName("User Name", True, False)
If lst.Size > 0 Then
Dim Number As String = lst.Get(0).As(Contact).PhoneNumber
End If
But the error on highlight line is:
java.lang.RuntimeException: Field: PhoneNumber not found in: sjs.sendmsg.wmcontactsutils$_cucontact
I tried also with
B4X:
Dim Numbers As Map = lst.Get(0).As(Contact).GetPhones
Dim lstContacts As List
lstContacts = mContactsUtils.FindContactsByName("a", False, False)
For Each Contact As cuContact In lstContacts
Log(Contact.DisplayName)
Dim lstPhones As List
lstPhones = mContactsUtils.GetPhones(Contact.Id)
For Each PhoneNum As cuPhone In lstPhones
Log(TAB & PhoneNum.PhoneType & TAB & PhoneNum.Number)
Next
Next
Dim lstContacts As List
lstContacts = mContactsUtils.FindContactsByName("a", False, False)
For Each Contact As cuContact In lstContacts
Log(Contact.DisplayName)
Dim lstPhones As List
lstPhones = mContactsUtils.GetPhones(Contact.Id)
For Each PhoneNum As cuPhone In lstPhones
Log(TAB & PhoneNum.PhoneType & TAB & PhoneNum.Number)
Next
Next