I need help with Firebase

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

Make sure what are you getting in the global timer using the option do it. It seems it is retunred nothingthats why get value shows empty-string

Hey Dogukan_TV


Then you can see if you’re getting the value data or {}

1 Like

:person_raising_hand: @Dogukan_TV
After getting result from ‘got text’ don’t forget to add a fallback and even do a temporary check result using alert notifier.

If you are unaware of that json decoded text result, then check using is a dictionary or is a list blocks and

true for dictionar, then create a simple card.

Finally the important part, don’t forget to add the fallback.

If it is a dict, then use if size = zero show something else, else go-ahead..

and one more thing, make sure to clear the ids before creatingDynamic…
:+1:

Wait a minute… :thinking::thinking::thinking:

:palm_up_hand:Where is the firebase component…? :person_shrugging:

I think they mean that they’re retrieving data from Firebase via Web component.

For @Dogukan_TV

Official Documentation

GET - Reading Data

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.

Anyway, if you show us what you’re receiving as responseContent, as already suggested, it would be much easier to understand what the problem is

yep… sorry my mistake… :person_raising_hand:

Literally, make sure of this thing… :backhand_index_pointing_down:

While checking for FB storage, this pop-up surprised me…

if “I do have no idea” = true
then call 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 had a bit of time to run a test and I think I found the problem, the extension you’re using to create dynamic images

doesn’t accept URLs as a path…

Even though the extension page states otherwise, I think it’s a bug… I tested it with DynamicComponents by :raising_hands: yusufcihan :raising_hands:

and everything works perfectly.

Could you please send me photos of the sample blocks?

Of course

1 Like

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.

My Firebase URL: https://ProjectİD-default-rtdb.firebaseio.com/filmler

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.

Since you already have filmler in the Join,

the URL should only be "https://ProjectID-default-rtdb.firebaseio.com/"

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.

:partying_face:

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.

I did as you said, but when I open the app, the photos don’t appear; the screen remains blank. Why?

Think about what you did :grin:
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.

1 Like

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? :grinning_face:


Here you go,

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 :kodular: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.