Android Question How to get contact list with only mobile phone ?

Serway

Member
Licensed User
Longtime User
Hello,

Is there a way to get a contact list that has a mobile phone number ?
"FindContactsIdFromData" retrieve all the contact but i'd like to retrieve only contact that have a mobile phone number.
In order to speed up the recovery processing of contacts and include a search (MiniSearchView class) only on these.

Thanks for your help,
Thierry
 

asales

Expert
Licensed User
Longtime User
Add this sub to ContactsUtils to get all contacts that have a phone with type = mobile:
B4X:
Public Sub FindContactsWithMobilePhone As List
   Return FindContactsIdFromData("vnd.android.cursor.item/phone_v2", "data2", "2", "=", True, True) '2 = mobile
End Sub
I have this sub in ContactUtils, but the FindContactsIdFromData returns only DisplayName and Id in list.
How I can get the mobile number too in the list?

My code:
B4X:
Dim ctu As ContactsUtils
Dim allContacts As List = ctu.FindContactsWithMobilePhone
Log(allContacts)
'(ArrayList) [[DisplayName=Customer, Id=14, IsInitialized=True
'], [DisplayName=Hans Bikes, Id=290, IsInitialized=True
'...
 
Last edited:
Upvote 0
Top