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
1 answer

Android Multi-Touch ACTION_POINTER_UP MotionEvent.getX IllegalArgumentException

Currently I am working on a game that implements Android multi-touch by overriding the onTouchEvent method. In it I have a for loop going over all of the pointers. However, sometimes on ACTION_POINTER_UP this fails to work correctly and throws an…
0
votes
1 answer

storing variables from onTouch MotionEvent - Android

I have an imageView & I want to find out in which direction the touch is moving. On DOWN, it stores the X and Y coordinates in variables initX and initY. On move, it stores the current coordinates on finalX and finalY. I have these variables…
Heinz
  • 75
  • 1
  • 9
0
votes
2 answers

How can i pass same motion event to all items in listview?

I have a listview where every item is textview and custom view. Here is layout of listview item:
Aleksey Bulin
  • 85
  • 2
  • 9
0
votes
0 answers

Using OnTouchListener to play audio until release

I'm trying to come up with a way to play an audio clip, and have it loop, until the button associated with that audio clip is released, much like a sample pad. How would one do this?
0
votes
0 answers

onTouchEvent MotionEvent position is 1 pixel out

Create a simple View with a coloured background and override onTouchEvent. Then using the Simulator, click exactly the top left corner pixel of the view (use eg “Digital Color Meter” on mac to check the click position) The MotionEvent coordinates…
Bbx
  • 3,184
  • 3
  • 22
  • 33
0
votes
0 answers

Android onFling MotionEvent not change

I'm working on a project and I'm using a ImageView that is moved in onScroll, I recently implemented an onFling to detect swipe but I just saw that when I swipe the picture, the two MotionEvents from the onFling get the same X value using getX().…
PepeF
  • 1
  • 2
0
votes
1 answer

Android MotionEven.Action_MOVE

I have the following snippet of code (From this chathead tutorial), the point of the last switch case is to handle the drag on the view, but I can't quit understand how the logic works : ... params.gravity = Gravity.TOP |…
Omar BISTAMI
  • 770
  • 2
  • 11
  • 19
0
votes
1 answer

Android - Events Passing from Dialog to MainActivity

I have an app where I am using different players for playing different types of streams e.g. I am using MediaPlayer and YoutubePlayerSupportFragment through the YouTube player API. So for this I have made a separate controller for Play/Pause/etc,…
Abbas
  • 3,529
  • 5
  • 36
  • 64
0
votes
0 answers

How to disable batching for ACTION_MOVE event recieved in onInterceptTouchEvent?

Presently, I receive at most two ACTION_MOVE after ACTION_DOWN, and no matter how much I drag, no subsequent ACTION_MOVE is received in onInterceptTouchEvent of ViewPager. Is there a way to receive ACTION_MOVE more frequently?
q126y
  • 1,589
  • 4
  • 18
  • 50
0
votes
1 answer

Tablayout with recyclerview not swipeable on items

I'm using a tablayout with 3 fragments, each fragment has its own recyclerview. When trying to swipe from a fragment on a item the tablayout doesn't change tabs. I probably have to override a certain motionevent, but I don't know how. I hope…
0
votes
3 answers

Conditionally consume MotionEvents

public class CalendarEventView extends LinearLayout { public CalendarEventView(Context context) { super(context); } public CalendarEventView(Context context, AttributeSet attrs) { super(context, attrs); } public CalendarEventView(Context…
ovg
  • 1,486
  • 1
  • 18
  • 30
0
votes
1 answer

Continue scrolling from one Activity to another

I have two activities: ActivityA & ActivityB. ActivityA is listening for motion events. When a scroll event takes place, ActivityB is launched immediately. ActivityB has a scrollable content inside, and I want it to begin scrolling this content…
EyesClear
  • 28,077
  • 7
  • 32
  • 43
0
votes
1 answer

when button click to activated mouse scroll in android

After button click to mouse scroll to be activted,then scroll up to value increment and scroll down to value decrement.Button inside code here not working, my sample code here,please analysis code to help me. enter code here public class…
dhineshkumar
  • 51
  • 1
  • 6
0
votes
1 answer

Motion event of Touch is not working properly in android

I'm using this code to move a button. movement is happening but the button is sliding down a little bit when start moving. I'm also changing the color of the button when touched. public boolean onTouch(View view, MotionEvent event) { float…
Sourav Roy
  • 323
  • 4
  • 12
0
votes
0 answers

Android - Registering touches on two different zones of the screen separately

Basically, I just want to know when there is a touch on the left side of the screen, or right side of the screen, or both. I know how to retrieve the action of the event by using .getAction(), but this doesn't work; when one side is already pressed…