Reputation: 6819
I used AsyncTask
to request for a large chunk of data. When received, the data is processed inside the onPostExecute
method. It may take a while to process the data.
Based from my understanding, AsyncTask
is asynchronous and is independent from the UI.
onPostExecute
?Activity
to freeze if processing inside the onPostExecute
method is too long?Activity
won't freeze onPostExecute
?Upvotes: 0
Views: 1479
Reputation: 58
doInBackground
method.onProgressUpdate
onPostExecute
. try getting filtered or parsed data (lighter data) in onPostExecute
.Upvotes: 2
Reputation: 93
Make sure you are using doInBackground
method in your AsynTask
method.
Upvotes: 0
Reputation: 3485
see Long Running Task You Need to Bind in doInBackground
here you cannot Bind UI control Like Button
, ImageView
etc. After completion of doInBackground
in onPostExecute
you can Bind All Require Control, make sure here[onPostExecute
] you not runnning Another task.
Upvotes: 0
Reputation: 2888
Why does my Activity freezes onPostExecute?
According your post, you perform some time consuming operation on PostExecute method. On PostExecute is running on UI thread, so it's okay that you UI is freezed.
Is it normal for an Activity to freeze if processing inside the onPostExecute method is too long?
Yes, it's. You should perform long operation in doInBackground method (non-UI thread)
How do I make it such that my Activity won't freeze onPostExecute?
Try to transfer your long time operation to doInBackground method and in PostExecute just update UI according response, which you get after operations in doInBackground method.
Upvotes: 1