Questions tagged [motionevent]

MotionEvent object used to report movement (mouse, pen, finger, trackball) events. Motion events may hold either absolute or relative movements and other data, depending on the type of device. Motion events describe movements in terms of an action code and a set of axis values. The action code specifies the state change that occurred such as a pointer going down or up. The axis values describe the position and other movement properties.

468 questions
0
votes
2 answers

How do I make imageView respond to double tap and recognize when imageView is pressed, unpressed(action down, up)?

I want image to respond to 3 actions: image pressed(action down) - image becomes large image unpressed(action up) - image becomes normal size again double tap on image - image moves somewhere I have been trying to do it this way: public class…
ERJAN
  • 23,696
  • 23
  • 72
  • 146
0
votes
1 answer

MotionEvent multitouch offset (multiple pointers)

I have implemented a ZoomViewGroup, which is capable of scrolling infinitely in all directions and also zooming infinitely while still delivering all touch events correctly offset to its child Views. But when it comes to multi-touch, only the first…
bricklore
  • 4,125
  • 1
  • 34
  • 62
0
votes
1 answer

MotionEvent - action_move (listening for action_up) in java

Let's say that I have a motion event, that when I hold a key my cannon shoots balls. Everything is okay but I needed to create a while() loop for this inside this event, cause balls were lagging. The point is here I can't escape this event. The…
user5064340
0
votes
2 answers

Making an ImageView follow touchpoint on screen

I am working on an Android app where I would like the user to be able to drag their finger on the screen and have an object I have set up as an Image View (a plane) follow it. I have a somewhat working model of this right now where the image will go…
atg963
  • 197
  • 1
  • 3
  • 14
0
votes
0 answers

How can ViewPager's height be changed at runtime while in MotionEvent.ACTION_MOVE with the getRawY factor

I have a ViewPager and on touch of its tabstrip, I'm moving the whole ViewPager with the touch movement. At this point I want the ViewPager to adjust its height accordingly. I have…
0
votes
1 answer

Android multitouch: no ACTION_POINTER_DOWN and UP events

Here is my code: public boolean onTouch(View v, MotionEvent event) { switch(event.getActionMasked()) { case MotionEvent.ACTION_DOWN: Log.d("getButtonCode", "catch ACTION_DOWN"); break; case…
Alexander Tumanin
  • 1,638
  • 2
  • 23
  • 37
0
votes
1 answer

How do I press and drag and leave imageView where i unpressed my finger?[android]

ImageView currentImage = (ImageView) findViewById(R.id.image) ; onTouch(View v, MotionEvent event){ if(event.getAction() == MotionEvent.ACTION_DOWN){ float x = event.getX() ; float y = event.getY(); currentImage.setX(x) ; …
ERJAN
  • 23,696
  • 23
  • 72
  • 146
0
votes
0 answers

VelocityTracker produce's unwanted negative results

UPDATE: This person seems to know what I'm talking about https://code.google.com/p/android/issues/detail?id=174970 Current Project: I'm working on a remote mouse and I am using a VelocityTracker to get the X and Y movements needed. (I tried using…
Jurko Guba
  • 630
  • 7
  • 17
0
votes
0 answers

Why can't this html change body color when I shake my phone?

I leaned that html5 contains a device motion detector and wrote this html. I opened this html with my cell phone browser. ... var color = new Array('#FFF8DC', '#DC143C', '#00FFFF', '#00008B', '#008B8B', '#B8860B', '#A9A9A9',…
zhngnmng
  • 23
  • 3
0
votes
1 answer

How do I finish tracking ACTION_MOVE in android?

As I know, if my onTouch method returns false, after the initial ACTION_DOWN case it does not start tracking the movement, and if I return true, it does. But I have some cases when I need to stop tracking the movement from some moment. How do I…
vcmkrtchyan
  • 2,536
  • 5
  • 30
  • 59
0
votes
1 answer

Stopping drawable animation after first loop

My problem is trying to figure out how to stop the drawable animation after it iterated though the images (eg. it being back to the grapes image). I certainly can't use the method I implemented in .ACTION.DOWN so can anybody help me with this. …
user3606724
0
votes
1 answer

button clickable only with a stylus

I have a button that I would like clickable only by a stylus. I used the method setClickable to enable or disable the click on the button, but how can I do that is clickable only with a pen? the button should be clickable only when…
spyker10
  • 129
  • 2
  • 11
0
votes
1 answer

Counting pointers correctly with getPointerCount()

i'm writing an Android app for a school project that performs a different action depending on how many fingers the user taps the screen with. Right now this action is just to display the number of pointers detected as a toast. I'm using the…
AVStark
  • 1
  • 1
0
votes
0 answers

MotionEvent onScroll when views are inf foreground

Does anyone know how to handle the user's Gestures when views are in the foreground? I am still detecting no gestures when the finger moves over views. It just works when you are touching the background. Thanks a lot. :)
Alex Yo
  • 1
  • 1
0
votes
2 answers