I’m developing a movie streaming app and I wanted to automatically add movie titles and images using Firebase, but I’m getting an error. Please help!
Eror
Runtime Error
The operation CreateDynamicImage cannot accept the arguments: , [empty-string], [com.google.appinventor.components.runtime.VerticalScrollArrangement@f66069f], [film1], [200], [200], [true], [false], [true]
Note: You will not see another error reported for 5 seconds.
Dismiss
Considering that in the error the imageId parameter is "film1", it means the response is dictionary and is being read correctly, it simply doesn’t contain a key called "resim".
Make sure your database has a structure like this.
if “I do have no idea” = true thencall notifier1 show alert = “any idea” @RaYzZz , @Ibrahim_Jamar , @Still-learning etc… elseif “even these @'s have no idea” = true then = create new topic.
The reason I got the previous error was because I forgot to enter the video URL and image link in the Firebase Realtime Database section. After entering them, I got the error again. Can you help me?
I created the blocks you mentioned, but I got an error. Why?
Runtime Error
The second argument to foreach is not a list. The second argument is: nothing
Note: You will not see another error reported for 5 seconds.
Keep in mind that this tip is gold, whenever you receive any error from an external resource, it’s a good practice to add a notifier that shows what you’re receiving (maybe use a message dialog since the response will be quite long).
Notifier and Do It are essential for troubleshooting the app.
I followed your instructions and it worked, but even though it’s working, I’m still getting errors. Why?
Runtime Error
All component IDs must be unique, the component ID ‘film1’ has already used before.
Note: You will not see another error reported for 5 seconds.
The error, as you can see, tells you that you’ve created two dynamic components with the same ID.
This usually happens when you call the procedure that generates the dynamic images twice.
Before using Web.Get again, make sure you’ve removed the components using DynamicComponents.Remove.
You might find useful to have a procedure that loops through all the generated component IDs and remove them.
Think about what you did
There’s a loop with another loop inside it that removes all the dynamic components.
So for each key, you end up generating an image component and then removing all the components.
The correct approach would be to place the deletion loop right at the beginning of Web.GotText, so that all components are removed before generating them again.
Edit:
Anyway, Vega_Star had already shown you how to do it,
I just tried to simplify it even more without using CardView and procedures.
Thank you so much for your help. It worked irresponsibly. I have one more question. If you have time, could you tell me how to open the video when I click on the image?
There are quite a few small changes and additions but the most important thing I want to explain is the Any components.
To capture an event from a dynamic component, we need to use a block that intercepts all events of that component type in this case, an image.
If you look at the drawer on the left in the blocks editor, there is a section called Any component.
By adding an image to your main Screen, this section will be populated with the “Any” properties for that component.
We need to capture clicks on the image, so we will use the WhenAnyImage.Click block.
(After adding the block in the editor, you can also delete the image component from the Screen)
I recommend studying how DynamicComponents work, as it’s extremely useful, the ommunity is full of examples and guides.
If you plan to have a very long list, I suggest switching to RecyclerList, which is more efficient. However, it works quite differently, so it’s probably better to learn DynamicComponents first since it’s simpler, and then move on to RecyclerList.