I want to make a tiny little animated alert icon, and i've tried using the frame by frame code, but i've failed so far.
the code i'm using is this:
Using xml Syntax Highlighting
- <frames id="selected" oneshot="false">
- <frame drawable="@drawable/alert_ico" duration="50" />
- <frame drawable="@drawable/alert_ico2" duration="50" />
- </frames>
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
and the java basically this:
Using java Syntax Highlighting
- // Load the ImageView that will host the animation and
- // set its background to our AnimationDrawable XML resource.
- ImageView img = (ImageView)findViewById(R.id.alert_l);
- img.setBackgroundResource(R.drawable.alert_ico);
- // Get the background, which has been compiled to an AnimationDrawable object.
- AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground();
- // Start the animation (looped playback by default).
- frameAnimation.start();
Parsed in 0.031 seconds, using GeSHi 1.0.8.4
This is my layout xml code:
Using xml Syntax Highlighting
- <ImageView
- android:id="@+id/alert_btn"
- android:layout_width="30px"
- android:layout_height="31px"
- android:layout_alignParentRight="true"
- android:src="@+id/alert_l"
- />
Parsed in 0.001 seconds, using GeSHi 1.0.8.4
I get no errors compiling but the app just crashes.
If someone can explain what i'm doing wrong i'd be most appreciative, or point me to a tutorial.



