Hello,

Je souhaite faire une chose assez simple à priori : faire clignoter une image!
Je retourne le problème depuis plusieurs heure mais je n'arrive à rien de concluant !

Voici mon code :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 
package monandroid.packageandroid;
 
import android.app.Activity;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
 
public class MonActivite extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        try {
			RunAnimations();
		} catch (InterruptedException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
    }
 
    private void RunAnimations() throws InterruptedException {
        Animation fadeIn = AnimationUtils.loadAnimation(this, R.anim.fadein);
        fadeIn.reset();
        Animation fadeOut = AnimationUtils.loadAnimation(this, R.anim.fadeout);
        fadeOut.reset();
        ImageView iv = (ImageView) findViewById(R.id.imageView2);
        iv.clearAnimation();                   
        iv.startAnimation(fadeIn);
        iv.startAnimation(fadeOut);        
        }
 
}

Mes animations (res/anim)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
<?xml version="1.0" encoding="UTF-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 
    <alpha android:fromAlpha="0.0" 
    android:toAlpha="1.0"
    android:startOffset="0" 
    android:interpolator="@android:anim/accelerate_interpolator"  
    android:duration="3000"
    android:repeatCount="infinite"        
    />    
 </set> 
 
 
<?xml version="1.0" encoding="UTF-8"?> 
<set xmlns:android="http://schemas.android.com/apk/res/android"> 
    <alpha android:fromAlpha="1.0" 
    android:startOffset="3000"    
    android:toAlpha="0.0" 
    android:interpolator="@android:anim/accelerate_interpolator"  
    android:duration="3000" 
    android:repeatCount="infinite"
    />
 </set>

Merci d'avance pour votre aide!!