I have a button, when user clicks it, it will update the entire UI(textview, graphs). The content of the UI comes from a SQLite database, I named the update function loading(). You could imagine, inside the loading(), there are lots of database operations and UI updates. 
When the size of the data getting bigger, the time for this loading() to be done is longer, so the button will stay in pressed state for a longer time. 

I tried to use **asynctask** to deal with this situation so that a progressdialog comes out instead of the button freezed, but I cannot place the loading() method on the doinbackground() of **asynctask** because doinbackground() cannot touch the UI components that are declared from the onCreate() method of its activity.

I don't want to rewrite the loading() function.

Any other way to do so?? Please help, and if you could, please provide some examples, I appreciate that.