Contacts question

anaylor01

Well-Known Member
Licensed User
Longtime User
I am trying to get the example below to work but I am getting the following error.
Compiling code. Error
Error compiling program.
Error description: Loop iterator should be a numeric variable.
Occurred on line: 75
For i = 0 To listOfContacts.Size - 1
Word: =

B4X:
Dim Contacts1 As Contacts
Dim listOfContacts As List
listOfContacts = Contacts1.FindByName("John", False)
For i = 0 To listOfContacts.Size - 1
    Dim Contact As Contact
    Contact = listOfContacts.Get(i)
    Log(Contact) 'will print the fields to the LogCat
    Dim photo As Bitmap
    photo = Contact.GetPhoto
    If photo <> Null Then Activity.SetBackgroundImage(photo)
    Dim emails As Map
    emails = Contact.GetEmails
    If emails.Size > 0 Then Log("Email addresses: " & emails)
    Dim phones As Map
    phones = Contact.GetPhones
    If phones.Size > 0 Then Log("Phone numbers: " & phones)
Next
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…