Android: how to update UI dynamically?

Posted by pandre on Stack Overflow See other posts from Stack Overflow or by pandre
Published on 2011-11-24T09:38:42Z Indexed on 2011/11/24 9:50 UTC
Read the original article Hit count: 180

Filed under:
|
|

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?

© Stack Overflow or respective owner

Related posts about android

Related posts about asynchronous