I\'m confused as to when one would choose AsyncTask over a Handler. Say I have some code I want to run every n seconds which will update the UI. Why would I choose one ove
If you want to do a calculation every x seconds, you should probably schedule a Runnable
on a Handler
(with postDelayed()
) and that Runnable
should start in the current UI thread. If you want to start it in another thread, use HandlerThread.
AsyncTask is easier to use for us but no better than handler.