Timer, or Handler for capturing data at regular intervals in Android mobile apps?
I am writing an Android app that uses the accelerometer t开发者_如何学编程o record captured data at regular time intervals and store them into SQLite.
Is is better to use Timer
(and TimerTask
), or Handler
for this task?
I would use a Handler
in a TimerTask
. Then I would use this task with a Timer
.
I would personally use a Handler
. How are you recording the data?
Handler is right way not timertask....You can directly use it for view invalidation not timer task
精彩评论