14
I'm trying to implement gesture in my app and for some reason the the onfling() is not being called. I tried reading numerous posts regarding this and tried fixing my code but it's not working . The below is my code. Please have a look:
public class MainMenuSlider extends Activity implements OnClickListener{
protected MyGestureListener myGestureListener;
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 ViewFlipper vf;
private Animation animFlipInNext,animFlipOutNext, animFlipInPrevious, animFlipOutPrevious;
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mainmenuslider);
myGestureListener = new MyGestureListener(this);
//vf for viewflipper
vf=(ViewFlipper)findViewById(R.id.ViewFlipper01);
animFlipInNext = AnimationUtils.loadAnimation(this, R.anim.flipinnext);
animFlipOutNext = AnimationUtils.loadAnimation(this, R.anim.flipoutnext);
animFlipInPrevious = AnimationUtils.loadAnimation(this, R.anim.flipinprevious);
animFlipOutPrevious = AnimationUtils.loadAnimation(this, R.anim.flipoutprevious);
imageone = (ImageView) findViewById(R.id.imageone);
imagetwo = (ImageView) findViewById(R.id.imagetwo);
imageone.setOnClickListener(myGestureListener);
imagetwo.setOnClickListener(myGestureListener);
}
class MyGestureListener extends SimpleOnGestureListener implements OnTouchListener
{
Context context;
GestureDetector gDetector;
public MyGestureListener()
{
super();
}
public GestureDetector getDetector()
{
return gDetector;
}
public MyGestureListener(Context context)
{
this(context, null);
}
public MyGestureListener(Context context, GestureDetector gDetector)
{
if(gDetector == null)
gDetector = new GestureDe