0

I am working on an activity which uses async task. So I have created an animated activity which I want to show in onPreExecute of this async task and I don't know how to do it.

So is there any way to solve my query?

Saurabh
  • 136
  • 1
  • 1
  • 11

1 Answers1

0

In onCreate call some like below

mdialog=new Dialog(this);
new LongOperation().execute("");

Then override onPostExecute:

@Override
protected void onPostExecute() {
   mdialog.dismiss();
}
Arpit Jain
  • 94
  • 1
  • 5
  • I have to use Animated activity in onPreExecute. – Saurabh Dec 29 '16 at 09:58
  • OnPostExecute runs on UI thread. It is a built in mechanism from AsyncTask to realize a background operation (doInBackground) for example network request and Update UI onPostExecute. onPreExecute runs on UIThread too. It is used to show progress bar for example. Please refer to AsyncTask Doc https://developer.android.com/reference/android/os/AsyncTask.html You will never use runOnUiThread onPre or onPostExecute!!! – Santiago SR Mar 07 '17 at 13:45