Mobile contact access

I am building app which require access to mobile contacts. Already used LeoContact ext. But app is not able to get permission for "read contacts". Attaching my code blocks. When I attempt get "read contact" permission it shows error as - "attempt to invoke interface method 'java.lang.string java.lang.charsequence.tostring()' on a null object reference".... Pl help me here.


How do you do that? Please provide a screenshot... first ask for permission in Screen Initialize and after having received the permission, then get the contact list ( I.e. NOT in Screen.Initialize)

Here is updated code blocks. Now, I am not getting contact access error... But no data of contact name on display... I waited for 5 min but app is not displaying anything. Is there any thing wrong with code blocks ?? I am expecting only names of my contacts in list view.

What is the purpose of that loop in the GotContactList event?
Does it make sense to add the complete nameList as each item in the new list called name? not really...

What about displaying the nameList and numberList in a label to find out, if you get a result?

Also remove the first row in the PermissionGranted event...


I updated the code blocks as per your instructions.... still app is not displaying two sets of list ... for names & for numbers... I am not able to catch the error.

My suggestion was


oh sorry... I missed that one.. now updated. Still app is not showing NameLabel & NumberLabel.. There must be some error in my code blocks.

Still I am not able to get contact data - name label & number label from Leo contact ext.

can someone help me ??

I now asked the developer for you

btw. in your latest screenshot unfortunately you still do not assign the results to labels

set Label1.Text to nameList
set Label2.Text to numberList


1 Like

Just tested in companion Android 13 (real device), works perfectly


1 Like

I got the error as following.. and app displays nothing.

Attempt to invoke interface method 'java.lang.String java.lang.CharSequence.toString()' on a null object reference

It looks like I am not able to get access to contact of mobile phonebook. I already used permission block.


Don't call the GetContactList block in permission granted event, put it in a button click event (this will only work first time your run the app). Why did you not just copy my blocks?

following is error snap


following is code block snap


What device are you testing on ?

are you testing in the companion app or after building with the apk file or both?

probably now it is time to reveal the device and Android version you are using for your tests?
did you try another device?


1 Like

I am using companion app on android phone with version 10.

What happens on that device if you use the native Contact Picker (in the Social drawer) ?

I used contact picker. It's only taking one contact after manual selection. I need all phone numbers & respective names in separate list to build my business card app.

what about being more specific? which device manufacturer?