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.
Questions tagged [motionevent]
468 questions
0
votes
1 answer
capturing both clicks and drags in android
I am overriding both onTouch and onClick. Each is supposed to result in different actions (very important). I don't want a touch to be both a touch and a click: it must be either-or. I am not having much luck. How do I get my app to discriminate…

Cote Mounyo
- 13,817
- 23
- 66
- 87
0
votes
1 answer
Set picture in ImageView as long as the screen in touched
I want to set the image named "pic" in the ImageView as long as the screen is touched.
I am a beginner and don't what the code should be in the cases of MotionEvent , can someone help me with this.
This is my code:
public void onCreate(Bundle…

user2558256
- 223
- 3
- 16
0
votes
1 answer
Dragging a Path
I'm trying to drag a path around my canvas by re-plotting the coordinates, stored in an array of point, then re creating it. The path drags but flips horizontally and vertically, like a mirror image, over where the user clicks. I have no idea…

user1056798
- 245
- 6
- 20
0
votes
1 answer
Android Multitouch issue with game controllers
I am writing an app that has two soft d-pads on the screen. I am having extreme difficulty trying to capture and understand all the touch events for two simultaneous touches because the fact that every ACTION_MOVE event says that the id is equal to…

Matthew
- 3,886
- 7
- 47
- 84
0
votes
1 answer
How to animate button\view from within another buttons ontouch ImageButton view?
See http://www.passsy.de/multitouch-for-all-views/#comment-47486 of which the most relevant code appears below.
If one "TestButton" which extends button is pressed, that view is passed to my "TestButton" code and I can animate that button/view. But…

John Ashmore
- 1,015
- 1
- 10
- 25
0
votes
1 answer
Why will same GestureEvent code work on android 2.3.5 but not on 4.0.3
This code will work on a phone with 2.3.5 but not on a tablet with 4.0.3:
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
…

M364M4N cro
- 680
- 2
- 10
- 23
0
votes
1 answer
MotionEvent getY(1) returns wrong value
I programm a gesture detector manually (I have my reasons) and listen to the onTouchEvent.
I was wondering why my picture was jumping around a bit sometimes and it turns out that on multitouch always getY(1) == getY(0), which is not the case…

Gunnar Bernstein
- 6,074
- 2
- 45
- 67
0
votes
2 answers
Error on Long Press Android Event
I try to show a toast when user long press android screen....but nothing showing.Why?Simple touch shows toast " touch " work fine! Where is the error?
public class MainActivity extends Activity {
Handler handler = new Handler();…

antkan
- 61
- 1
- 2
- 7
0
votes
1 answer
OnTouchListener (MotionEvent) animation
I've figured out how to work with the ontouch listener, but I still some problems.
I want to animate an 2D Map viewed from bird perspective, the viewed area is calculated by an set coordinate which is in the middle of the screen.
I want to get the…

G4meM0ment
- 55
- 1
- 9
0
votes
1 answer
Prevent OnTouchEvent on siblings
How do I block onTouchEvent from a view's siblings? I have a ViewGroup with a custom button in it. When the button receives an OnTouchEvent, I want to block further OnTouchEvents from going to the button's siblings. I do want to continue…

Peri Hartman
- 19,314
- 18
- 55
- 101
0
votes
2 answers
Change EditText via slide/scroll/drag and normal input when only just touched
I would like to use two ways to change the input of my EditText field.
The EditText field will be only allowing number ("12.34" format).
Normal behavior:
When the user touches the EditText it should show the keyboard and just behave like a normal…

patrick
- 1,282
- 4
- 21
- 37
0
votes
2 answers
If i keep the screen pressed, I change the activity, can i get the motion event for action_up in the second activity?
I have an application, where i have a video player, with videos. If i keep my finger on the screen for more than 0,4 seconds, it finishs this activity, starts the recorder activity, and automatically starts recording. My question is: can i make the…

rosu alin
- 5,674
- 11
- 69
- 150
0
votes
2 answers
Click + move an object
I'm currently using the MotionEvent.ACTION_MOVE function to detect if a user moves an object (in this case, an ImageView).
The problem is that now my algorithm gets more complicated and I need to distinguish if a user clicks on this object or moves…

thomaus
- 6,170
- 8
- 45
- 63
0
votes
1 answer
Android: MotionEvent's x and y pixel do not translate to image coordinates
I am using the getX() and getY() functions in MotionEvent to get the x and y positions of where the user touched the screen. I am also capturing images using the android camera. These images are 480x640. My intention is to use have the user draw a…

Nageen
- 31
- 1
- 6
0
votes
2 answers
Writing the logcat into an xml file in android
I am a little bit novice in android. I actually want to write the information that is shown in the logcat into an xml file that will be saved in the phone or in the computer.
Here is the logcat shown for my application and I would like to actually…

SaberTooth
- 157
- 1
- 4
- 15