et me revoila pour un nouveau souci je commence a croire,
que c'est vous qui allez concevoir mon app mdrrr,

bon donc voila j'ai réussi a faire mon système de viewflipper pour animer les vues, et j'ai aussi mis en place l’incrémentation et la décrémentation,
seulement le motionEvent n'a pas l'air d'agir et pourtant aucune erreur,
ni a la compilation ni autre d'ou peut venir mon souci :

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package com.m.h;
 
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.GestureDetector;
import android.view.GestureDetector.SimpleOnGestureListener;
import android.view.Gravity;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.ViewFlipper;
 
public class mh extends Activity {
 
	static String[] items ={"Ajoupa Bouillon", "Anses d'Arlet", "Basse Pointe", "	Bellefontaine", "Carbet", "Case Pilote", "Diamant", "Ducos", "Fond Saint Denis", "Fort De France", "François", "Grand Rivière", "Gros Morne", "Lamentin", "Lorrain", "Macouba", "Marigot", "Marin", "Morne Rouge", "Morne Vert", "Prêcheur", "Rivière Pilote", "Rivière Salée", "Robert", "Sainte Anne", "Sainte Luce", "Sainte Marie", "Saint Esprit", "Saint Joseph", "Saint Pierre"};
	private static final int SWIPE_MIN_DISTANCE = 120;
	private static final int SWIPE_MAX_OFF_PATH = 250;
	private static final int SWIPE_THRESHOLD_VELOCITY = 200;
	private GestureDetector gestureDetector;
	View.OnTouchListener gestureListener;
	private int currentIndex = 0;
	private int maxIndex = 30;
 
	ViewFlipper flipper;
 
	Animation slideLeftIn;
	Animation slideLeftOut;
	Animation slideRightIn;
	Animation slideRightOut;
 
 
 
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
 
        flipper=(ViewFlipper)findViewById(R.id.details);
 
        slideLeftIn = AnimationUtils.loadAnimation(this, R.anim.slide_left_in);
        slideLeftOut = AnimationUtils.loadAnimation(this, R.anim.slide_left_out);
        slideRightIn = AnimationUtils.loadAnimation(this, R.anim.slide_right_in);
        slideRightOut = AnimationUtils.loadAnimation(this, R.anim.slide_right_out);
 
        flipper.setInAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_in));
        flipper.setOutAnimation(AnimationUtils.loadAnimation(this,android.R.anim.fade_out));
 
        for (String item : items)
        {
        	 Button btn =new Button(this);
        	 Button btn2 = new Button(this);
        	 btn.setText("categorie");
        	 btn2.setText(items[currentIndex]);
        	 LinearLayout mylayout = new LinearLayout(this);
        	 mylayout.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        	 mylayout.addView(btn);
        	 mylayout.addView(btn2);
 
 
 
 
 
        	 flipper.addView(mylayout, new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
 
 
        }
 
		gestureDetector = new GestureDetector(new MyGestureDetector());
		gestureListener = new View.OnTouchListener() {
			public boolean onTouch(View v, MotionEvent event) {
				if (gestureDetector.onTouchEvent(event)) {
					return true;
				}
				return false;
			}
		};
 
	}
 
	class MyGestureDetector extends SimpleOnGestureListener {
	@Override
	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {
	     try {
				if (Math.abs(e1.getY() - e2.getY()) > SWIPE_MAX_OFF_PATH)
					return false;
				// right to left swipe
				if (e1.getX() - e2.getX() > SWIPE_MIN_DISTANCE
						&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
					flipper.setInAnimation(slideLeftIn);
					flipper.setOutAnimation(slideLeftOut);
 
					if (currentIndex == maxIndex) {
						currentIndex = 0;
					}
					else {
						currentIndex = currentIndex + 1;
					}
 
 
					flipper.showNext();
				}
				else if (e2.getX() - e1.getX() > SWIPE_MIN_DISTANCE
						&& Math.abs(velocityX) > SWIPE_THRESHOLD_VELOCITY) {
					flipper.setInAnimation(slideRightIn);
					flipper.setOutAnimation(slideRightOut);
 
					if (currentIndex == maxIndex) {
						currentIndex = 0;
					}
					else {
						currentIndex = currentIndex - 1;
					}
 
					flipper.showPrevious();
				}
			}
			catch (Exception e) {
				Log.e("Log_tag", "Erreur switch"+e.getMessage());
			}
			return false;
		}
	}
 
 
 
 
        }
bon vous allez me dire que ma boucle for ne sert a rien,
mais elle ne doit normalement pas empêcher le bon fonctionnement du programme, et pourtant quand je glisse mon doigt sur mon tel rien et pareil avec la souris sur l’émulateur.