Will this make the current UI thread to sleep?
try
{
Thread.sleep(20);
onProgressUpdate(i);
} catch (InterruptedException e) {
e.printStackTrace
Thread.sleep(time) will causes the thread which sent this message to sleep for the given interval of time. So if you call it in UI thread, it will affect the UI thread. As far as android is concerned it is not advised to obstruct UI thread in any way, otherwise it will result in ANR - application not responding.
You can refer this