0
Stopwatch android question please help
click on the link below and scroll down.my question is the most recent post about timewatch https://plus.google.com/107321672913287932096
13 ответов
+ 1
sorry
i didnt get what you mean
do you want to delete the handler?
0
i meant like this If(running){
seconds++;
postDelayed(this,1000);
}
when i put postDelayed(this,1000); inside the curly braces,the time watch stop working.why?
0
could you show me the code
0
sorry
i cant see any error
0
i have added comment in the code.u should be able to understand my question now
0
oh sorry
i got it right now
in your code at the beginning of the watch
it will check the value of "running"
if it is true it will be repeated
else it will stop being repeated
you need to let it repeat even if the "running" is false
by the way
i think you are using Head first
i suggest to you
Android programming the big Nerd ranch guide 2nd edition
Its very good i think
0
i asked why postdelayed cannot be inside the if statement.u didnt mention postdelayed method in your answer.
0
i meant when the postDelay() is in the if statement
it will work just if its true
but when you begin the app "running" is false so
postDelay() wont work
0
if i put postDelay() in the if statement and press the start button.it doesnt start at all
0
postDelay() is inside runtimer()
when the app begins the runtimer() works
and see that "running" is false
so postDelay() wont work and runTimer() wont work even if you changed the value of "running" unless you called it again
0
when i remove "handler.postDelayed(this, 1000);"
it doesnt work too.why?i thought if running is true seconds will increment too...seconds++
0
can you explain why it works when i put handler.postDelayed(this, 1000); inside if statement.