System of likes or hearts

Friend, everything worked fine until I realized that I changed the value very badly haha


  1. The user has 10 hearts in the database
    When I give it 1 heart, it takes away the 10 hearts I had and puts 1 in the database and when I give it heart again it puts 0 in the database, since you have to add it takes the value of it label number of hearts of the app …? What can I do in this case so that it adds me and does not put the value of the label of hearts …

Try putting a global variable as total hearts that come to me from the database and add that total amount with the click and so I could send the total value, however it does not work for me :c

You Have To Use 2nd Way For That

For Example If I Have 10 Hearts In Database So We Need To Store It Some Where In Variables Or In Label Or In TinyDB

When User Click On Heart icon You Have To Increase It By Adding(+) 1 So It Will Be 11 And When User Click It Again So You Need To Decrese It By Minasing (-) 1 So It Will Be 10

Ps ::
You Need To Store Total Clicks Not Click

Click Is For Detecting How Much Time User Clicked

1 Like

thank you very much friend

Another thing friend, when I see the arrage (visible - I use several arrays in a single screen) it does not show me the correct amount of hearts that that user has, but when I enter for the second time, if it throws me the number of hearts, I mean the corresponding value to that user.

In a few words, I should enter 2 times to view the arrage or enter the screen 2 times to show me the true value … my question is, how can I refresh the database so that it tells me the correct value when I first enter time.

I am sorry for my bad english.
Refresh the database so that when I log in for the first time I get the true result “the first time”.

Which Database Are You Using ?


Use This For Load Data When First Initialize
blocks (3)

blocks (2)

And For Refresh In Real Time Use

blocks (4)

Friend, I don’t use several screens, if not several arrays, I mean I hide and show arrays. How aria in that case?

Explain More Clearly

Look at the problem is that I have a label that tells me the number of hearts that a user has, ok everything is perfect. The problem is when I change the value in the firebase there is the value of the label in the app, it marks the old one but not the resent.

what I want is for the label value to be changed in real time. with firebase how could I do that?

Use This Methode To Get Data In Real Time

I put that same one and it doesn’t work. We are talking about the “data change” right?

Yes Use Data Change

Otheewise Send Blocks Pic If Not prive or Pm If Private

if you are now satisfy with system of like and heart can you tell me how the experience so far with firebase method i also want to implement this in my app should i go with @Srrazmi blocks (2nd way ) kindly give me your sugesstion

1 Like

Hi , :smiley:
When the user exits the application and logs in again, he will be able to like the person to be evaluated. How do I prevent this? (Knowing that there is such a personality that I want to evaluate)

Your Can Store There Click On TinyDB To Prevents Double Clicking After Re Staring Application

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.