Back to project page RockFall-Android.
The source code is released under:
GNU Lesser General Public License
If you think the Android project RockFall-Android 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 eu.raffprta.rockfall.app; // www . j av a 2 s. c om import android.util.Log; import android.view.DragEvent; import android.view.MotionEvent; import android.view.View; public class TouchHandler implements View.OnTouchListener { private int x,y; private boolean isActivated = false; @Override public boolean onTouch(View view, MotionEvent motionEvent) { this.x = Math.round(motionEvent.getX()); this.y = Math.round(motionEvent.getY()); if(motionEvent.getAction() == motionEvent.ACTION_DOWN){ isActivated = true; } else if(motionEvent.getAction() == motionEvent.ACTION_UP ) { isActivated = false; } return false; } public int getX(){ return this.x; } public int getY(){ return this.y; } public boolean isActivated(){ return this.isActivated; } }