Aaah ole sorry that way.. I do it with the companion
Which version of Companion are you using?
version 2.73a
We would need to see all the blocks that potentially use this list. When exactly does this error occur? After clicking a button?
Here are the blocks. I use case sensitive menu's for input data. The error occurs when ask for the latest call for the list.
Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
I have tried to debug the code. This are some results. The first comment is from my phone, the second from "do it" in the code.
Is there more I can focus to? I do not really understand what is going on here...
to debug, first disable all your blocks in button btnDialAct... and only enable the first if - then statement, then test
in case it works, enable additionally the next if then statment etc until you find the bug
Taifun
To be sure, update companion to the latest test version. Also try it in a compiled apk. Because it may be a companion error and you are wasting your time.
I think I found the problem.
The second time the procedure with listview is called it doesn't stop and goes immediately further with afterpicking. Because there is no selectionindex made yet, it asks for a right index in the list.
There must be something changed with listview because before the change I hadn't this problem.
Yes, when resetting the list, the selection and selection index is also reset to 0. Since we are changing the list, everything has to be reset, because the listView is not sure that the selected item will be the same as before. That's why I wrote somewhere higher in the messages, so that you protect your code from index 0. Just, if index == 0, do nothing.
I saved the code at your advice and it works just right. Problem solved!!!!!
Thank you very much!!!!
Just one question left. Why doens't stop listview the second time to wait for afterpicking?
What do you mean by "doesn't stop"? Generally, programmatic selection and list resetting do not trigger the after picking event. Only physical finger selection.
I mean that the first time it shows a menu to choose from. From my perspective it waits for a physical selection. Then it goes further with afterpicking. The second time it also takes the afterpicking procedure without waiting for physical input.
See the article on why you can't wait in AI2
I don't think so, I just tried it and changing the list or even programmatically selecting a list item does not trigger AfterPicking, so you are executing code outside of AfterPicking somewhere.
We would need to see the entire code to determine where the problem lies. Debug your code, e.g. adding a notification in the AfterPicking event to see if the event is fired after the next load of the list.