Search code examples
androidmultithreadingandroid-asynctaskprogress-barrunnable

Running ProgressBar on busy UI thread


I need some work to be done on the UI thread, but this means I can't also (that I know of) display a ProgressBar as the UI is busy executing other tasks.

I know this sounds a bit illogical, but is there a way to display an indefinite ProgressBar on the UI thread while the UI thread is busy?

I am aware of using Runnables and AsyncTasks, I'd use them to complete the actual work if I could, but can these be used for displaying the ProgressBar itself?


Solution

  • Just show a textview with Loading... in it, or some other static view (imageview with progress, that doesnt spin). Any other solution will need to do the work on the UI.

    I would really check my code in order to free the UI because the if u use the UI for too long the user wouldnt be able to press back or anything and he will feel as the the app is stuck.