I performed a similar task using AsyncTask. AsyncTaskhas a method onProgressUpdate(Integer)that you can call every iteration, for example, or every time that progress is made while doInBackground()calling publishProgress().
See docs for more details .
user456118
source
share