Thanks Erel, I am doing this approach, however it is so slowly, and put a black screen because take too much time, it is working fine show the correct values, but take 12 sec. and I guess put the black screen because the APP is too busy, the next code, show only the contacts using a mobile phone number and sorted by displayname. work fine, but soooooooooo slowly.
Dim allContacts As List = cu.FindAllContacts(True)
allContacts.SortType("DisplayName", True)
For Each c As cuContact In allContacts
For Each phone As cuPhone In cu.GetPhones(c.Id)
'Log("cu.GetPhones(c.Id)= " & cu.GetPhones(c.Id))
If phone.PhoneType="mobile" Then ' Filter My interest is only the number with mobile attribute.
If temp <> c.Id Then ' Filter any repeated number.
' Log(c.DisplayName)
clv3.add(CreateListItem(c.DisplayName,clv3.AsView.Width, 50dip), 50dip, c)
temp = c.Id
'Log("temp ="&temp)
End If
End If
Next
Next
I noticed the problem is in this part of For and Next. I had been checking the contactUtils class, I am not sure, perhaps in contactUtils put in list array and consume time, because put all the PhoneType in the list and later with my code filter only mobile from that list.
Dim allContacts As List = cu.FindAllContacts(True)
allContacts.SortType("DisplayName", True)
For Each c As cuContact In allContacts
For Each phone As cuPhone In cu.GetPhones(c.Id) '<---------- this is taking too much time , this For next
'Nothing here on purpose
Next
Next
How can we improve the speed? Am I doing a bad approach? or minimal avoid the black screen, the ProgressDialogShow("bla bla bla") does not show neither.
Thanks you Erel and the community of B4A..