Reputation: 32207
I have a view with a ProgressBar
on it that just sits and spins (smoothly).
Meanwhile I'm doing a network load via AsyncTask
. When the load is done, I'm processing all the JSON
data into a visual layout which takes about 1.5 seconds to do. However, during that 1.5 seconds my ProgressBar
animation comes to a complete halt.
How can I make it so I can process the data, but keep my animation smooth as well?
Upvotes: 0
Views: 470
Reputation: 3090
Though it is difficult to assess without code to work with, I will give it a shot.
You could simply process the JSON and create your View
inside the AsyncTask
and then pass the View
back to the GUI thread in onPostExecute
.
This way no heavy calculations are being done on the GUI thread.
Upvotes: 1