Listview selection error

I have this same error message appearing randomly in my app too. It started a few days ago when I built the app in the test environment and now it happens with 188 (with companion 2.62u). I was previously having the text filter problem with a list view - which has now disappeared in both live and test - but its left this nasty behind.

1 Like

Dear, with the new update of the listview, do the test again, but when I enter the screen I get this error, does anyone know what it could be?

Attempt to invoke virtual method void androidx.cardview.widget.CardView.set BackgroundColor(int) on a null object reference

Thank you

1 Like

Looking into this.

2 Likes

OK, it appears that when SelectionIndex is called in screen initialize event, the CardView objects have not been loaded into the ListView yet.

This could also happen if the SelectionIndex is set using blocks when the element being selected is not displayed on the device screen.

I am submitting a fix. I'm not sure what the timing of the release will be. Until then, in most cases the selection should work on a later event.

6 Likes

@Susan_Lane

Restart only works the first time.

Borrar_Elemento_Lista.aia (2.5 KB)

1 Like

What behavior do you expect, and what are you observing?

When click the btn_restart, the lista_numbers is loaded into the ListView.
When click btn_remove, I delete the selected element.

When click the btn_restart again, the lista_numbers doesn't load in the ListView, I was expecting it to load.

(Tested in MIT Companion 2.62 and installed)

2 Likes

Don't know when can get the latest update ?

1 Like

Getting the same error with listview after compiling to apk.

Screenshot_20211119-211213

1 Like

Another error

Screenshot_20211119-210836

1 Like

I think there are multiple issues being reported on this thread, and I'm having trouble sorting them.

@Juan_Antonio has posted a project that is giving unexpected results, and they believe it is an issue with the Refresh block. Correct?

@albert_choong has posted a screenshot of an index error in setBackgroundColor. Can you provide me blocks or a project where this occurs?

1 Like

Not the Refresh block.

These blocks:
lista_borrar2

When you load lista_numbers into the ListView1.Elements the first time, it loads successfully.

(Edited) But if you delete items from Elements list and reload the ListView, it no longer loads correctly.

Borrar_Elemento_Lista_2.aia (2.5 KB)

1 Like

@Susan_Lane Today release nb188 ; Look same problem still there...

Here's a sample listview aia with the error...

"Attempt to invoke virtual method void
androidx.cardview.widget.CardView.set BackgroundColor(int) on a null object reference"
Listview.aia (1.9 KB)

I am not setting any background color for the listview.

Just setting visibility on or off and selecting an item by selection or index via blocks.

Well, you have to refresh the "lista_numbers" after having modified it because handling with lists means dealing with adresses not with values. Assigning the "lista_numbers" to the "ListView.Elements" means passing an adress. All what happens to that will happen to the original one "lista_numbers". Or start with:
ListView.Elements=copy list(lista_numbers); then you won't have to refresh the "lista_numbers".


:slight_smile:

2 Likes

@Susan_Lane I found that this bugs start +- 2021-11-11; why not incharge person roll back to previous version first and slowly check the bugs ?

It works fine in version 2.61 of the Companion App but I have the same problem in version 2.62

I'm investigating.

In our major fall release, there was a big update to ListView. It's not surprising that we're finding bugs. I appreciate the reports.

Hi, listview update with image is cool ! thanks AI
But I also encountered " attempt to invoke virtual ....BackgroundColor(int)' on a null object reference.
Using listcopy did not solve the problem for me. In my case, Crash occurs when using the the "set listview. selected Index" command which fires a null object error.
This does not occur with the "get listview.selected Index" command which returns the good, value.
Selected index will stay unshaded after a listview refresh, but that will do for me until AI kindly takes care of this little problem.

Enclosed example displays data form a dictionary. bloc which causes problem is disabled
Regards.
testListView.aia (58.9 KB)

Hi everybody
The problem is not yet resolved
Please is there any solution?