Hello,
the b4a phone library contains read only access to the contacts.
but how about writable access? people often asked, but statement here was that it is not possible.
But after a little bit research in this forum i mentioned that b4a has a very good support for external libraries. It seems, that almost all lower functions are loaded from an external library.
So i wrote an library (the first in my live ). Using it is is really easy:
Sourcecode and binary of the lib are attached in miscUtil.zip
Copy miscUtil.jar and miscUtil.jar to your libraries folder.
b4a testproject is attached in libtest.zip
Enjoy
Michael
the b4a phone library contains read only access to the contacts.
but how about writable access? people often asked, but statement here was that it is not possible.
But after a little bit research in this forum i mentioned that b4a has a very good support for external libraries. It seems, that almost all lower functions are loaded from an external library.
So i wrote an library (the first in my live ). Using it is is really easy:
B4X:
Sub Button1_Click
'Add libs phone and my miscUtil
Dim mu As miscUtil, c As Contact
mu.Initialize
Dim name As String, phoneNr As String, phoneType As Int, mail As String, mailType As Int
'define contact data
name = "Mike Tester"
phoneNr = "004912345678"
phoneType = c.PHONE_HOME
mail = "mike@tester.com"
mailType = c.EMAIL_HOME
'create contact
mu.createContactEntry(name, phoneNr, phoneType, mail, mailType)
'thats all folks :-)
'check success, new contact should be the last entry in the list l
Dim cs As Contacts
Dim l As List
l = cs.GetAll
For i = 0 To l.Size - 1
c = l.Get(i)
Log(c)
Next
End Sub
Sourcecode and binary of the lib are attached in miscUtil.zip
Copy miscUtil.jar and miscUtil.jar to your libraries folder.
b4a testproject is attached in libtest.zip
Enjoy
Michael
Attachments
Last edited: