Android Question [Solved] "AnimatedCounter" not showing values sometimes

AnandGupta

Expert
Licensed User
Longtime User
Facing problem of "AnimatedCounter" not showing values.

I am calculating from resultset and showing the collection, expenses and balance values in animated counter. But for some strange reason the "Balance" counter is not showing numbers sometimes. I have put the video showing the problem.

vlc_e1u0ssqyte.gif


All counters have same in setting other than color. Below is the code I use to update the counter.
B4X:
        ancColl.Value = nRcpTot
        Sleep(1000)
        ancExps.Value = nPayTot
        Sleep(1000)
        ancBala.Value = nRcpTot-nPayTot
        Sleep(1000)
I have added sleep each time, as trying to fix it, but no solution.
 
Solution
It appears to me that the "sometimes" that the bottom counter does not show is when the value is (or should be) negative. Does this give you a clue? I don't know how the counters are supposed to work.

Brian Dean

Well-Known Member
Licensed User
Longtime User
It appears to me that the "sometimes" that the bottom counter does not show is when the value is (or should be) negative. Does this give you a clue? I don't know how the counters are supposed to work.
 
Upvote 0
Solution

AnandGupta

Expert
Licensed User
Longtime User
It appears to me that the "sometimes" that the bottom counter does not show is when the value is (or should be) negative. Does this give you a clue? I don't know how the counters are supposed to work.
Eureka! You hit the nail.
I put
B4X:
Log(nRcpTot-nPayTot)

and there it showed the -ve values.
B4X:
7200
2480
4480
-1630
2770
740
4740
-695
1305
-1915
2485
-485
1115
-1595

It sample data where the balance has become -ve, but I did not knew that it will make such fuss for animated counter. The real data do not have -ve balance as it is cash balance.
Thanks for solving it.
 
Upvote 0
Top