Share to EffectHub.com

You can earn money or coins from your share:)

Tips: you can use Sparticle for uploading away3D effects.

Tips: you can download Sparticle for uploading effects.

Tips: The ActionScript editor is supporting Away3D, Starling, Dragonbones and Flex frameworks.

Tips: paste the web page URL then click button:)

EffectHub.com: Your Best Source for Gaming
Login    or

Android:GestureDetector Demo

package com.example.widgettest;import android.app.Activity;import android.os.Bundle;import android.util.Log;import android.view.GestureDetector;import android.view.GestureDetector.OnGestureListener;import android.view.MotionEvent;import android.widget.Toast;public class TouchTest extends Activity implements OnGestureListener {		public int verticalMinDistance=100;	public int minVelocity=50;	private  GestureDetector mGestureDetector; 	public String tag="TouchTest";		@Override	protected void onCreate(Bundle savedInstanceState) {		// TODO Auto-generated method stub		super.onCreate(savedInstanceState);		mGestureDetector=new GestureDetector(this);			}	@Override	public boolean onDown(MotionEvent e) {		// TODO Auto-generated method stub		Log.d(tag, "onDown");		return false;	}	@Override	public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX,			float velocityY) {		// TODO Auto-generated method stub		Log.d(tag, "onFling");		 if (e1.getX() - e2.getX() > verticalMinDistance && Math.abs(velocityX) > minVelocity) {  			    		        Toast.makeText(this, "to left", Toast.LENGTH_SHORT).show();  		    } else if (e2.getX() - e1.getX() > verticalMinDistance && Math.abs(velocityX) > minVelocity) {  		    		        Toast.makeText(this, "to right", Toast.LENGTH_SHORT).show();  		    }  		 		return false;	}	@Override	public void onLongPress(MotionEvent e) {		// TODO Auto-generated method stub		Log.d(tag, "onLongPress");	}	@Override	public boolean onScroll(MotionEvent e1, MotionEvent e2, float distanceX,			float distanceY) {		// TODO Auto-generated method stub		Log.d(tag, "onScroll");		return false;	}	@Override	public void onShowPress(MotionEvent e) {		// TODO Auto-generated method stub		Log.d(tag, "onShowPress");	}	@Override	public boolean onSingleTapUp(MotionEvent e) {		// TODO Auto-generated method stub		Log.d(tag, "onSingleTapUp");		return false;	}	@Override	public boolean onTouchEvent(MotionEvent event) {		// TODO Auto-generated method stub		return mGestureDetector.onTouchEvent(event);	}}


...

You must Sign up as a member of Effecthub to view the content.

1828 views    0 comments

You must Sign up as a member of Effecthub to join the conversation.

ChOw

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: helpers/time_helper.php

Line Number: 22

2013-11-06
>>Back to Android group


Latest Posts


Sponsor


They are waiting for your help



Share

Join Effecthub.com


Or Login with Your Email Address:

Or Sign Up with Your Email Address:
This field must contain a valid email
Password should be at least 1 character

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: views/footer.php

Line Number: 6

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 21

A PHP Error was encountered

Severity: Notice

Message: Undefined index: HTTP_ACCEPT_LANGUAGE

Filename: controllers/topic.php

Line Number: 85