Search code examples
androidapp-inventor

Problems with Listpicker App Inventor


I'm a beginner at App Inventor and I don't know what I'm doing wrong with the listpicker. I am trying to create and app to reproduce the music I have stored in my server but when i display the listpicker I can't click any of the options and also I can't go back to the first screen. Here I put my code:

Image 1 enter image description here Image 2 enter image description here

I tried to remove the line that says call listpicker.open but it only made appear a totally black screen. The result of the code I just posted is exactly what I spect a list with the name and the link of the 2 songs I already upload to my server but when I click them it didn't do anything.

Thanks for your help.


Solution

  • The Web component works asynchronously, which means, it takes a little bit, until the result is available. The result you will get in the Web.GotText event.

    Therefore it does not make sense to call the updateListpicker procedure in the Listpicker.BeforePicking event, because the result still is not available and you get displayed an empty listpicker. The listpicker will be opened, before you have received the result!

    Set the listpicker to visible=false and use a button.click event to call the updateListpicker procedure. Then as you already do it in the Web.GotText event, assign the received list to the listpicker and open it.