Skip to content Skip to sidebar Skip to footer

Android Animation In Asynctask

I have an animation like this img = (ImageView) findViewById(R.id.animView); anim_up = AnimationUtils.loadAnimation(this, R.drawable.bounce); public void upAnim(View view){ i

Solution 1:

As Matthias has mentioned in the question's comments, all animations should be done on the UI thread. For an AsyncTask, the doInBackground() method is called on the background thread whereas methods like onPreExecute(), onProgressUpdate(), onPostExecute() and onCancelled() are called on UI thread. Based on when you want to show your animation, override the appropriate AsyncTask method and make the call accordingly.

Learn more about the lifecycle of AsyncTask here.

Post a Comment for "Android Animation In Asynctask"