Count the numbers of items from a List Viewer and show the info

Guys, I have a notification screen and a user panel as shown in the figure below. I would like that every time I send a notification to the user the amount of notifications is registered as it happens on facebook. Can you do that?

Menu Screen

Notification Screen


You need to have a variable that accumulates that value of 1 in 1. But it all depends on how you want it to be accumulated. After reading, do you want the number to be maintained or decreased?
One solution would be to place a counter inside your loop.

Let it be maintained and accumulated as soon as new posts are placed. This button that I placed clears the list should it also do with the counter: 0
Can you give me an example?

Accountant (without me knowing his logic).
Notifications must be counted from time to time to find out how many “new” notifications there are in the database. So in summary: run a count to your bank from time to time. Timer component triggers this procedure that will count the number of notifications.

Read this. I have explained it there already.