Hi everybody I am trying to do animation with drawable animation class....I am able do it with xml file.But i wanted to do it with code.But it's not working.Only the first image is getting displayed.No animation happens.Please tell me what wrong i m doing??
public class animation extends Activity {
/** Called when the activity is first created. */
protected Drawable anim1,anim3,anim2;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
ImageView img=new ImageView(this);
LinearLayout l1=new LinearLayout(this);
AnimationDrawable frameAnimation=new AnimationDrawable();
System.out.println("####"+frameAnimation.toString()+"####");
this.anim1 = this.getResources().getDrawable(R.drawable.test2);
this.anim3 = this.getResources().getDrawable(R.drawable.test3);
this.anim2 = this.getResources().getDrawable(R.drawable.test4);
frameAnimation.addFrame(anim3, 500);
frameAnimation.addFrame(anim1, 500);
frameAnimation.addFrame(anim2, 500);
System.out.println("#######"+frameAnimation.isRunning()+"##########");
img.setBackgroundDrawable(frameAnimation);
frameAnimation.start();
System.out.println("###no of frames"+frameAnimation.getNumberOfFrames()+"####");
setContentView(img);
System.out.println("#######"+frameAnimation.isRunning()+"##########");
}[marq=left]

... I could see that there were drawable objects inside the animation array, but they never appeared.
I've searched for something on Google and I read some mails saying that there is no complete support for this yet (BUGGGG)
. You can try to construct your own animation logic with individual drawables. Do it. Don't waste your time for now with AnimationDrawable class. 
