Timmeah wrote:Is there a way to make an image blink?
I found a way to do it with a animated GIF-file (with the android.graphics.drawable.AnimationDrawable-class), but this isn't a very nice solution.
The next code should also be a solution, but it doesn't seem to work as well. What am I doing wrong??
I looked at
here and
here.
I´m getting a fore
Using xml Syntax Highlighting
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/splashAnimation"
android:oneshot="false">
<item android:drawable="@drawable/splash1" android:duration="3000" />
<item android:drawable="@drawable/splash2" android:duration="50" />
<item android:drawable="@drawable/splash3" android:duration="50" />
<item android:drawable="@drawable/splash4" android:duration="50" />
<item android:drawable="@drawable/splash5" android:duration="50" />
<item android:drawable="@drawable/splash6" android:duration="50" />
<item android:drawable="@drawable/splash7" android:duration="50" />
<item android:drawable="@drawable/splash8" android:duration="50" />
<item android:drawable="@drawable/splash9" android:duration="50" />
<item android:drawable="@drawable/splash10" android:duration="50" />
<item android:drawable="@drawable/splash11" android:duration="50" />
<item android:drawable="@drawable/splash12" android:duration="50" />
<item android:drawable="@drawable/splash13" android:duration="50" />
<item android:drawable="@drawable/splash14" android:duration="50" />
<item android:drawable="@drawable/splash15" android:duration="5000" />
</animation-list>
Parsed in 0.006 seconds, using
GeSHi 1.0.8.4
This would go somewhere in your code, like the onCreate function if you want it to fire off when your app starts
Using java Syntax Highlighting
ImageView animation = (ImageView) findViewById( R.id.splashAnimation );
animation.setBackgroundResource( R.drawable.splash_animation );
AnimationRoutine animationRoutine = new AnimationRoutine( );
Timer t = new Timer( false );
t.schedule( animationRoutine, 100 );
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4
Using java Syntax Highlighting
private class AnimationRoutine extends TimerTask {
AnimationRoutine( ) { }
public void run( ) {
ImageView img = (ImageView) findViewById( R.id.splashAnimation );
AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground( );
frameAnimation.start( );
}
}
Parsed in 0.031 seconds, using
GeSHi 1.0.8.4