I recommend you to use ContactsUtils. It is possible to open the standard phone book however the result varies between different devices.
I'm not familiar with any library that opens the standard contacts book. It is quite simple to open the standard phonebook with an intent.
I did look into it in the past however the results were not satisfying / reliable enough.
Intent1.Initialize(Intent1.ACTION_PICK,"content://contacts/people/")
StartActivity(Intent1)
You can open the phone book with this intent:
B4X:Intent1.Initialize(Intent1.ACTION_PICK,"content://contacts/people/") StartActivity(Intent1)
However in order to get the result you will need to create a small library as explained here: Guide - Using onActivityResult
Sub Button1_Click
'Dim Contacts As Contacts
'Dim list1 As List
list1 = Contacts.GetAll
Dim listOfNames As List
listOfNames.Initialize
'Create a list with the contacts names
For i = 0 To list1.Size - 1
Dim c As Contact
c = list1.Get(i) 'fetch the Contact from the original list
If c.DisplayName.IndexOf("@") = -1 Then 'remove email, keep only contacts
listOfNames.Add(c.DisplayName)
End If
Next
listOfNames.Sort (True)
Dim res As Int
res = InputList(listOfNames, "Choose contact", -1)
If res <> DialogResponse.CANCEL Then
Dim name As String
name = listOfNames.Get(res)
'Dim c As Contact
'find the original contact based on the chosen name
For i = 0 To list1.Size
c = list1.Get(i)
If c.DisplayName = name Then Exit
Next
'Msgbox(c.GetPhones, "id")
Dim m As Map
m = c.GetPhones
'Dim cisla As List
cisla.Initialize
For index = 0 To m.Size-1
cisla.Add(m.GetKeyAt(index))
Next
Dim res2 As Int
res2 = InputList(cisla, "cisla", -1)
EditText1.Text = cisla.Get(res2)
End If
End Sub
Sub button2_click
list1 = Contacts.GetAll
listofcontacts = Contacts.FindByName(edittext2.Text , False)
list2.Initialize
For i = 0 To listofcontacts.Size - 1
Dim Contact As Contact
Contact = listofcontacts.Get(i)
list2.Add(Contact.DisplayName)
Next
Dim res As Int
res = InputList(list2, "Choose contact", -1)
If res <> DialogResponse.CANCEL Then
Dim name As String
name = list2.Get(res)
'find the original contact based on the chosen name
For i = 0 To list1.Size - 1
Contact = list1.Get(i)
If Contact.DisplayName = name Then Exit
Next
Msgbox(Contact.GetPhones, "id")
End If
Dim m As Map
m = Contact.GetPhones
'Dim cisla As List
cisla.Initialize
For index = 0 To m.Size-1
cisla.Add(m.GetKeyAt(index))
Next
Dim res2 As Int
res2 = InputList(cisla, "cisla", -1)
EditText1.Text = cisla.Get(res2)
End Sub