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
How to detect a MotionEvent inside dispatchTouchEvent
I have made a FragmentActivity. Some Fragments include an EditText.
I would like, when the Soft Input Keyboard is up and a MotionEvent happens - except the Event of clicking inside the EditText - the Soft Input to hide. Until now I wrote this code…

Stam
- 2,410
- 6
- 32
- 58
0
votes
1 answer
Multitouch - PointerIndex out of range
I try to fix an issue which appears in my code when I added multitouch functions in my app.
The problem seems to come from ACTION_POINTER_DOWN :
private float oldDist = 0;
backCard.setOnTouchListener(new OnTouchListener() {
@Override
public…

jbltx
- 1,255
- 2
- 19
- 34
0
votes
0 answers
How to interrupt the current touch on my view?
Iam using a ListView. when user starts dragging at a particular point i want to roll the list to a position,At that time user doesn't trigger ACTION_UP. since he is still on the same touch path.
Eg user starts dragging from position 5 and drags up…

Viswanath Lekshmanan
- 9,945
- 1
- 40
- 64
0
votes
2 answers
Filter for Axis Y on MotionEvent object
Is there a way to create a new object from a MotionEvent object that extract only the X axis movement (gesture) ?
@Override
public boolean onTouchEvent(MotionEvent event) {
MotionEvent xMotionEvent = filterYMotion(event);
return…

M'hamed
- 2,508
- 3
- 24
- 41
0
votes
1 answer
android listview item highlight effect with different image
I konw how to create highlight effect on listview item, this can be done by editing the selector xml file of the item background
BUT, what I want is, when user pressed the list item, not only the background change to another color, but also the…

Wood
- 945
- 1
- 9
- 18
0
votes
1 answer
One view over another view: top view should handle SOME MotionEvents
I have two views. One of them (bottom view) already handling scrolling, pinch-to-zoom, double tap and other actions. The second one (which lays over this one; let's call it top view) is my custom view. For example I want top view to handle long…

Lingviston
- 5,479
- 5
- 35
- 67
0
votes
1 answer
how to intercept horizontal flings on children of an android ListView
I'd like to respond to horizontal "fling" gestures on individual cells in a vertically scrolling ListView. Currently I've accomplished this by using a GestureDetector for each cell view in the list.
I'm noticing, though, that it's much harder to…

jph
- 2,181
- 3
- 30
- 55
0
votes
1 answer
Drawing a line following finger - motionevent.getX() and getY() incorrect UPDATE
UPDATE: please read entire question again :-)
Background:
I have created a grid of dots by creating a custom view and then adding these views to a TableLayout. The aim is for me to be able to draw a line from one of these dots to another dot in a…
user2442638
0
votes
1 answer
how to move edittext or imageview in only that particular relative layout?
public class MyActivity extends Activity implements View.OnTouchListener {
TextView _view;
ViewGroup _root;
private int _xDelta;
private int _yDelta;
@Override
public void onCreate(Bundle savedInstanceState) {
…

immodi
- 607
- 1
- 6
- 21
0
votes
2 answers
Getting the center Point of a MotionEvent Android
i need to calculate the center of a MotionEvent, eg when a user touch the screen with his finger, i want to know what is the point in x,y that is the center of this finger touch, i currently use motionEvent.getX() and motionEvent.getY() but it seem…

Ofek Ron
- 8,354
- 13
- 55
- 103
0
votes
1 answer
Button.onTouch() not being called
I have a button btnSpeak which i find by ID, i then try to set the MotionEventListener
package com.ctc.android.widget;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.DataInputStream;
import…

Stephen Murby
- 1,407
- 3
- 17
- 37
0
votes
3 answers
Using the correct MotionEvent for custom buttons
I m making an app and i want to use custom button skins . The code i use for changing background when the button is pressed is the following :
button3.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View…

mremremre1
- 1,036
- 3
- 16
- 34
0
votes
0 answers
ACTION_UP case is not triggering
Desired Outcome
I want to draw a red circle at the position the screen is touched then remove it when the touch is released.
Current Outcome
Whenever I touch the screen the red circle appears in the touched location, however when I release the touch…

user1041528
- 25
- 2
- 6
0
votes
1 answer
MotionEvent.ACTION_UP is not called
i have a problem with an OnSwipeImageListener (implements OnTouchListener). I use the OnSwipeImageListener in two activities.
On the one activitiy on the ImageView is the OnTouchListener and an OnClickListener and on the other activity on the…

user2717143
- 1
- 1
0
votes
1 answer
Shake Gesture Code Disabling Tweet Keyboard and Shake
The following code I have for a shake gesture works perfectly fine, it just when I have it across three separate uitableviews and once you leave one tableview to go to the next one, the shake gesture no longer works. Any idea how to make it work…
user331914