I am following http://developer.android.com/guide/topics/graphics/view-animation.html#frame-animation with minor changes. I have decided to make the animation loop and want
Run this in onResume():
class AnimTask extends AsyncTask<String, String,String> {
Activity act;
AnimTask(Activity act) {
this.act = act;
}
@Override
protected String doInBackground(String... params) {
act.runOnUiThread(new Runnable() {
public void run(){
animImg = (ImageView)findViewById(R.id.listen_anim);
animImg.setBackgroundResource(R.drawable.listening);
anim = (AnimationDrawable) animImg.getBackground();
anim.start();
}
});
return null;
}
}