When I initialice the screen I call tag list and then for each tag I call the values position and name, I save all data in 3 lists and all work perfectly. This always work when I run the app for fisrt time.
I recieve this information:
PLAYER LIST(PLAYER1,PLAYER2)
NAME LIST(ANDY,MARY)
POSITION LIST(2,1)
THE PROBLEM IS HERE. when i change the screnn and return to first I call again the database but I recieven a differente order like this:
PLAYER LIST(PLAYER1,PLAYER2)
NAME LIST(MARY,ANDY)
POSITION LIST(1,2)
This is not the correct order and this is just happening when I change screens, As I said before when I run the app for first time all work perfectly, always!
I thought maybe the list was adding items but not, when I change a screen, I open the new one and close the last oen so the lisst are resets to empty.
Yeah I know that when I call the tag list could be different and it doesnt matter for me actually, but look when I call for each value for each tag it has to be the same as firebase right?
So for example player 1, position is 2 and the name is andy in firebase but when I recieve the data and save in the lists the values have different order. player 1 has the values of player 2.
CORRECT DATA SAVED IN LISTS IN CORRECT ORDER:
PLAYER LIST(PLAYER1,PLAYER2)
NAME LIST(ANDY,MARY)
POSITION LIST(2,1)
THE PROBLEM IS HERE. when i change the screen and return to first I call again the database but I recieve a different order:
PLAYER LIST(PLAYER1,PLAYER2)
NAME LIST(MARY,ANDY)
POSITION LIST(1,2)
And for be clear it just happen when I change screens. always in firts time that I open the app I recieve the data correctly.
Well I am not need the data in the other screen. I mean the screen 1 has a listview with the data and the screen 2 is other thing like âabout usâ so it doesnt matter.
So when i open the app and open screen1 I recieve the data ok.
Then i open screen 2 and close screen 1, then I close screen 2 and open screen 1 again but here the data is wrong.
So for me the problem is that my data is saved wrong and I cant displayed property. If player 1 is index 1 so the values of her name and position has to be 1 and not different, are you understand me?
Hey it is very simple man. Try to use web component. I mean when ever screen initialize download the names in terms of json format instead of calling firebase tag list
This could be work but it is more complicate maybe I can use for a last solution and thank you I am really apreacciate your answer.
My question is if I am doing the correct process and the result is good at first time, why the values change when I change from screen to other screen?
Mostly firebase will store and retrieves value in terms of json format only. But this is the first time I m hearing after switch over of the screen dataâs order changed. Actually at very first time how you are getting the same format only you have to get it whenever you switched in from another screen
But this method will give in the same order how it is stored
I see in your code that you do not have a procedure to save data to firebase, does this mean that you entered data directly to firebase ? If so, you should add it using the following format
I change bit to bit with dora suggestions and I found a rare thing that is a solution for me.
I am just add other firebase component BUT i dont use it. I mean there are 2 firebase components in the proyect but in blocks I just use one. So this is rare but it works.
And the second component has to be empty in project bucket, if not the error is still there.