Back to project page 5th.
The source code is released under:
GNU General Public License
If you think the Android project 5th listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
? package com.zhanglin.practice; /*from w w w . java 2 s . co m*/ import android.view.MotionEvent; import android.view.GestureDetector.SimpleOnGestureListener; public class ChangeGestureDetector extends SimpleOnGestureListener { PlayingActivity activity; public ChangeGestureDetector(PlayingActivity activity) { this.activity=activity; } @Override public boolean onFling(MotionEvent e1,MotionEvent e2,float velocityX,float velocityY) { final int FLING_MIN_DISTANCE=100;// X??y????????(???) final int FLING_MIN_VELOCITY=200;// x??y???????(???/?) if((e1.getX()-e2.getX())>FLING_MIN_DISTANCE&&Math.abs(velocityX)>FLING_MIN_VELOCITY) { //activity.last();//?????????activity?????????? } else if((e2.getX()-e1.getX())>FLING_MIN_DISTANCE&&Math.abs(velocityX)>FLING_MIN_VELOCITY) { //activity.next();//?????? } PlayingActivity.gesture="true"; return super.onFling(e1,e2,velocityX,velocityY); } }