Android: how to update UI dynamically?
- by pandre
I have an Android app and I need to change UI dynamically:
ex: when user presses a button, I want to change the current activity's views and, as in some cases there are a lot of views involved, I need to display a ProgressDialog.
I have been using an AsyncTask, but I think that it is not the best solution, because AsyncTask's doInBackground runs a different thread, so I can't update UI from there - I have to use runOnUiThread, which runs the code in the UI Thread, but freezes the progress dialog that is shown.
I guess there should be more people with similar issues, as updating UI while displaying a ProgressDialog seems to be something done regularly by applications.
So does anyone have a solution to this?