Runnable behaviour differs debug/live

By davidw32 ·
Could anyone help with a problem to do with an android runnable please? It behaves correctly in debug but not when run live!
I have a layout with a canvas and 2 textviews. The canvas has a simple game and a runnable is used to alter the sprites many times a second. Based on some actions, a bit of code in the runnable sometimes updates a textview (a score). That works fine.
I wanted to add a timer/countdown to the game, so logged the time at the start
startTime = System.nanoTime()
and in the runnable added
float deltaTime = (System.nanoTime() - startTime) / 100000000000.0f;
if ((int)deltaTime > timerCount) {
timerCount = timerCount + 1;
Log.i(TAG, "Updating countdown");
In debug it works fine but when run live nothing happens - not even the log.
I added a clause to finish the activity if timerCount > 2: works in debug, not in live.
Any suggestions of what might be going on?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Share your knowledge

Related Discussions

Related Forums