Blinking images/objects possible

All your problems with Audio, Video and Images.

Blinking images/objects possible

Postby Timmeah » Mon Mar 16, 2009 11:32 pm

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.
Timmeah
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Feb 10, 2009 4:30 pm

Top

Re: Blinking images/objects possible

Postby Timmeah » Tue Mar 17, 2009 6:22 pm

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

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
  3.     android:id="@+id/splashAnimation"
  4.     android:oneshot="false">
  5.           <item android:drawable="@drawable/splash1" android:duration="3000" />
  6.           <item android:drawable="@drawable/splash2" android:duration="50" />
  7.           <item android:drawable="@drawable/splash3" android:duration="50" />
  8.           <item android:drawable="@drawable/splash4" android:duration="50" />
  9.           <item android:drawable="@drawable/splash5" android:duration="50" />
  10.           <item android:drawable="@drawable/splash6" android:duration="50" />
  11.           <item android:drawable="@drawable/splash7" android:duration="50" />
  12.           <item android:drawable="@drawable/splash8" android:duration="50" />
  13.           <item android:drawable="@drawable/splash9" android:duration="50" />
  14.           <item android:drawable="@drawable/splash10" android:duration="50" />
  15.           <item android:drawable="@drawable/splash11" android:duration="50" />
  16.           <item android:drawable="@drawable/splash12" android:duration="50" />
  17.           <item android:drawable="@drawable/splash13" android:duration="50" />
  18.           <item android:drawable="@drawable/splash14" android:duration="50" />
  19.           <item android:drawable="@drawable/splash15" android:duration="5000" />
  20. </animation-list>
  21.  
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


Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. ImageView animation = (ImageView) findViewById( R.id.splashAnimation );
  2. animation.setBackgroundResource( R.drawable.splash_animation );
  3.        
  4. AnimationRoutine animationRoutine = new AnimationRoutine( );
  5.        
  6. Timer t = new Timer( false );
  7. t.schedule( animationRoutine, 100 );
Parsed in 0.030 seconds, using GeSHi 1.0.8.4



Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. private class AnimationRoutine extends TimerTask {
  2.      AnimationRoutine( ) { }
  3.            
  4.      public void run( ) {
  5.           ImageView img = (ImageView) findViewById( R.id.splashAnimation );
  6.           AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground( );
  7.           frameAnimation.start( );  
  8.      }
  9. }  
Parsed in 0.032 seconds, using GeSHi 1.0.8.4
Attachments
animation.rar
(41.34 KiB) Downloaded 153 times
Timmeah
Junior Developer
Junior Developer
 
Posts: 14
Joined: Tue Feb 10, 2009 4:30 pm

Top

Return to Multimedia Problems

Who is online

Users browsing this forum: No registered users and 11 guests