Text and Image from Firebase Database not showing in my app (Need Help)

Hello,
I am using Firebase Database to load data into my app, but I am facing some issues:

Text is coming from Firebase but it is not showing in the app.

Image URL is also coming from Firebase, but the image is not displaying.

:backhand_index_pointing_right: Please check my blocks and let me know where I am making a mistake.
:backhand_index_pointing_right: I want to show both Text and Image together in one card/arrangement.

My Questions:

  1. How to correctly set Firebase text value into a Label?

  2. How to correctly show an Image using the URL from Firebase in Kodular?

  3. Is there anything wrong in my blocks that is stopping data from showing?

Thanks :folded_hands:

Hi Oham,

As you correctly wrote,

it would be very helpful to show the main blocks where you are encountering the error.

1 Like

It would be better to set the projectBucket directly on a higher-level node so you can get all the data at once instead of making all those getValue calls.
Could you show how your database is structured (hide any sensitive data if there are any)?

I apologize that I cannot reply quickly as my post is awaiting approval.

If you set your project bucket to “Categories” you can get all the categories in a single call,
Firebase will return a JSON text that can be used as a dictionary.

col_Bg.aia (903.5 KB)

I am adding aia for information.

Be careful, your private Firebase API key is in the project, will you change it later or do you want to hide it?

1 Like

I made some changes, let me know if you don’t understand something.
col_Bg.aia (902.9 KB)

1 Like

I have set up the project bucket as is, do I need to change any of the configuration?

Yes, but I later import this json file into another project. Right now, I need to solve this problem.

Yes, of course.

It’s working :smiling_face_with_three_hearts: Thank you for that. But one change needs to be made, the list of 10 main names should be visible on the first screen, but after clicking on it, the data that should be visible on the second screen is visible on this screen.

:partying_face:, im glad

Like this?

col_Bg.aia (902.7 KB)


EDIT:
To handle the click on the CardView, I suggest you do it like this.

1 Like

Great man :smiling_face_with_three_hearts::folded_hands: I can’t thank you enough, my big question has been resolved, thank you once again. If you have any doubts about this, please ask again.And yes, how can I display the category in label 1 of the second screen after the click event? Please tell me at the end. Thank you again.

There’s no need :heart_hands:

You have several options, but the simplest are

  • to save the data in TinyDB and retrieve it in the other screen,
  • or pass them directly in the startValue.

tinyDB

Screen home

  • You save the data as soon as they arrive from the Firebase.GotValue with a TinyDB.StoreValue.
  • On the CardView click, we pass the category name as the StartValue.

Screen show

  • We set the label to the StartValue
  • and get the category data from the data saved in TinyDB.

col_Bg2.aia (903.3 KB)

1 Like

StartValue

Screen home

The thing that seemed simplest to me is to pass a list to the other screen with the first value being the category and the second the data.

Screen show

Here we select the first item for the label and the second for the data.

1 Like

A post was split to a new topic: Store and retrieve data from Firebase