ListViews, again!

  • Fix a bug in removing an item from a listview resulting in bad indices (@timfoden)
    Release notes of feb, 19, 2024.

I have an app for a sailing course that I was using privately successfully for a few months and to which I wanted to make some enhancements because others wanted to use it too. It uses quite a few ListViews, for which the contents need to be changed occasionally.

To my grief I found that the app was not working properly anymore, although I did not make any changes.
After scratching my head for quite some time, I happened to look in the release notes and found that a bug was "fixed".

I know @ewpatton that we talked about ListViews, and I know now that the list of listview elements is immutable right now in AppInventor, but still, in my programming past it would not be OK to have this kind of regression without some kind of warning.

And again, in my use case, where there is a list of steps to take, where you can take out a step when you completed it, it is really inconvenient to have shadow lists that need keep the content of the list view.

1 Like

I doubt this little fix you mentioned would have any negative impact on the app's performance. The error was that the application crashed when we programmatically selected an element with index 0 from the list. There were no other changes.

Unless there was another fix that I didn't find.

Moreover, Android does not work in such a way that an application written a long time ago will still work well in a newer environment. Even google introduces various changes due to which developers have to constantly make changes to the code. Many methods become obsolete, new methods are introduced. Also big changes in permissions. If we have errors in components, we have to fix them, regardless of whether someone once used workarounds for these errors that now do not work.

I do not know about element 0. My problem was that I had a working .apk for about half a year, then I wanted to change something and I used the .aia of which the .apk was made. To my grief there was a problem for which it took me several days before I realized what it was: if you try to remove an element from the ListView (in my case the first one), nothing happens. So you need to have a shadow list, apply changes to that and set the elements again. Quite cumbersome.

Oh yes,it's the same problem you wrote about in the previous topic, about ListView.
I don't think the behavior you describe will return to ListView. You don't need an extra variable, ListView includes a block to remove an item. Just replace the blocks.

1 Like

@Patryk_F You don't need an extra variable, ListView includes a block to remove an item. Just replace the blocks.
Right! :hot_face:
I will try when I can get back to a PC.