60037

How check touch event

Question:

I searching about method which I check which way I touch screen and after that send information to touch event. I want to check if I touch screen one finger or two fingers or I move finger on screen. This is any method to check what I am doing my fingers on the screen befor application do some actions?

Answer1:

I think you can try this one.

A drag gesture starts when the first finger is pressed to the screen (<strong>ACTION_DOWN</strong>) and ends when it is removed (<strong>ACTION_UP</strong> or <strong>ACTION_POINTER_UP</strong>).

switch (event.getAction() & MotionEvent.ACTION_MASK) { case MotionEvent.ACTION_DOWN: savedMatrix.set(matrix); start.set(event.getX(), event.getY()); Log.d(TAG, "mode=DRAG" ); mode = DRAG; break; case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_UP: mode = NONE; Log.d(TAG, "mode=NONE" ); break; case MotionEvent.ACTION_MOVE: if (mode == DRAG) { matrix.set(savedMatrix); matrix.postTranslate(event.getX() - start.x, event.getY() - start.y); } break; }

for complete information check <a href="http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-5-implementing-the-drag-gesture/1789" rel="nofollow">here</a>

(or)

for document check <a href="http://developer.android.com/guide/topics/ui/drag-drop.html" rel="nofollow">here</a>

Recommend

  • Export a list of functions with roxygen2
  • Android ListView onTouchEvent doesn't give ACTION_DOWN
  • Save scaled image to sdcard android
  • To increase a button's size when it is pressed in Android
  • Andengine, how to move sprite with touchscreen
  • Using separate from tidyr with different length vectors
  • UICollectionView Enable deselecting cells while allowsMultipleSelection is disabled
  • How to capture video stream using emgu cv
  • How to find out which facebook mobile install ad was clicked after installing the promoted iOS app
  • Getting wrong UIButton tag on Long press gesture recognizer
  • Scons: create late targets
  • C++ password masking
  • JQuery UI selectable plugin - Multiple mouse drag selection and unselect option
  • How do I detect which submit button was pressed on a Zend Framework form?
  • Change color of row programmatically in WatchKit
  • Can't CTRL+Drag NSButton to custom NSView header
  • jquery draggable stop event
  • Add a div to replace Video after Video Plays Through
  • Capturing HTML Text Input Key press after key has been applied?
  • overlapping appointments using the entity framework
  • Pythons argparse default value doesn't work
  • Fully customized Python Help Usage
  • sweetalert2 inputoptions from file in select example
  • hibernate sets dirty flag (and issues update) even though client did not change value
  • Blackberry 6: how to detect a long click on track pad?
  • Switch to popup in python using selenium
  • uml Composition relationships to RDF and OWL
  • Javascript, Regex - I need to grab each section of a string contained in brackets
  • Possible to get mouse events fired when cursor is outside page?
  • Install PHP intl extension on MacOS
  • why xml file does not aligned properly after append the string in beginning and end of the file usin
  • Python CGI os.system causing malformed header
  • C# - Serializing and deserializing static member
  • Controls, properties, events and timers running in design time
  • Sending data from AppleScript to FileMaker records
  • Updated Ionic CLI but shows previous version (Windows)
  • Jquery - Jquery Wysiwyg return html as a string
  • Confusion with PayPal's monthly billing cycle
  • How to include full .NET prerequisite for Wix Burn installer
  • Is it possible to post an object from jquery to bottle.py?