Add Item to List Block Error

The Add Item to List block does not work in the current version of App Inventor. It was working in previous versions of app inventor.

It works...

can you explain deeper what problem you have?

Thanks for your quick response Ramon. I will gather screenshots of my code to explain the issue I am having in short order.

Be ready to prove that the thing you're adding an item to is really a list.

Hi Ramon,

As promised, here is the block that is nestled with an if condition. All the code does is assign text to the ListView1 element, as shown below:

Essentially, the need to initialize a variable would not be applicable to my code, as you had shown in your example, because I added a listview component and then used the add items to list block to assign some text. Please let me know if you need the entire coding environment.

Canned Reply: ABG- Export & Upload .aia)
Export your .aia file and upload it here.

export_and_upload_aia

.

Hi ABG,

Thanks for your quick reply. I will follow your instructions as displayed in short order.

I was unable to find that bit of code where you add an item to an Elements list.

A surefire way to do that would be to

  • copy the Elements list to a temporary (local) variable
  • add the item to the local list
  • copy the local list back to the Elements list.

When I tried to test your app, I got this far:

The subtraction failure is due to your disregard for mathematical operations in your choice of TinyDB default operations, all through your app's several screens. AI2 will refuse to do any sort of math (blue block) against empty text. So pick different default values when you retrieve from TinyDB, or immediately check them before trying to do any math (including comparisons) against them.

You might be seeing these errors all of a sudden because you are running your app on a new device, that has an empty TinyDB in it.

Regarding the file load error, that is outside my area of expertise. File operations have indeed changed in recent versions.

ALso, what is the point of this tautological comparison?

ABG,

Noted with thanks. I will continue to research to see I come up with a solution. But thanks again.

Will look into my tautological approach and see if i can simplify going forward.

cheers.

Do not add items directly to the ListView. First, create a variable containing the list. All addition and removal operations from the list should be performed on this variable. Each time you change the list in a variable, load the modified list into the ListView using the ListView.Elements block.