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

Scroll the button to top or bottom based on the finger movement

I have a custom view, which takes touch events.As a result, I cannot use scrollview. Since the page size is small, I want to scroll the view, using a custom scrollbar button. I'm able to scroll the view. But the problem is that I do not know, how…
0
votes
1 answer

What is a better way to implement a system wide side panel (similar to navigation drawer) in Android

My aim: have a Page slide onto the screen when the user swipes in from the left side of any screen. My current solution: I start my Service (GlobalTouchService) which creates a narrow transparent view (floatingView) with an OnTouchListener this…
vgergo
  • 71
  • 2
  • 7
0
votes
1 answer

Create a infinity loop and stop it

I'd like to create a infinity loop when I push a button and stop it when I release the button, so I create this, but it doesn't stop when I release the button... can you help me? public boolean onTouch(View v, MotionEvent event) { …
0
votes
2 answers

How to detect the view touch outside dragging?

I'm trying to code an imageView click feedback using the onTouch method. My code is used to scale the imageView when pressed(MotionEvet.ACTION_DOWN) and return to its normal size when the user stop pressing(MotionEvet.ACTION_UP). But what I'm not…
Joe Hackerberg
  • 457
  • 7
  • 20
0
votes
0 answers

Wrong number of touches on Android devices

On some Android devices e.g. Samsung S2 I receive an incorrect number of touches. For instance sometimes when I perform 3-4 simultaneously touches MotionEvent identifies only 2 of them. Looks like it's the device-specific issues, but is there a way…
Taras
  • 2,526
  • 3
  • 33
  • 63
0
votes
3 answers

Return view to original place after moving

I have a layout which contains text and wraps it. I need to move this layout vertically on the screen. This is what I do. View valuesContainer = view.findViewById(R.id.valuesContainer); valuesContainer.setOnTouchListener(new OnTouchListener() { …
masmic
  • 3,526
  • 11
  • 52
  • 105
0
votes
1 answer

dispatch ACTION_CANCEL without onInterceptTouchEvent

I am extending View and overriding onTouchEvent. I want to fire/dispatch MotionEvent.ACTION_CANCEL when the second finger touch the screen. Is there a way to do that?
Andreas
  • 87
  • 7
0
votes
3 answers

Matlab GUI windowButtonMotionFcn slows down when number of GUI object gets larger

I am now programming a Matlab GUI for accessing current point of cursor on an axes whenever user changes the location of cursor. However, I found a strange phenomenon that the speed of windowButtonMotionFcn got slower with an increase in number of…
0
votes
1 answer

Android: Triggering MotionEvent.ACTION_CANCEL

The Requirements: Ensure that itemLookup is only performed if the button has been held for at least 1 second. Stop the button event when the button has been held for 3 seconds, so the recording used for the lookup will not contain unnecessary…
esme_louise
  • 540
  • 2
  • 9
  • 28
0
votes
1 answer

How to use MotionEvents on imageview to change the image on ACTION_DOWN and ACTION_UP

I have seen on Google how to perform actions on MotionEvents of ImageView, what i want to do is change the image when user press the ImageView and reset to previous image when user release the ImageView, i am performing some reset code in my…
Darshan
  • 515
  • 1
  • 3
  • 16
0
votes
0 answers

View Visibility is not working on ACTION_MOVE

I am working on MultiDirectionSlidingDrawer motion events. I have a problem on Action_Move. I am unable to set Visible or Gone layouts on Action_Move. I have handle with two buttons. When I drag click on first button it should show the first view…
0
votes
1 answer

How to detect and distinguish between setOnClickListener event and event ACTION_MOVE on OnTouchListener()?

I'm creating an imageview in Android and try to make it movable by user's fingers. I need to handle 2 events, one is when I want to move the ImageView and the other is to long click on it. However, I'm facing an issue that when I'm moving the…
Long Uni
  • 101
  • 3
  • 12
0
votes
1 answer

In Android, how can I detect max margin when using MotionEvent?

I'm using MotionEvent to drag views around on the Y axis. I don't, however, want the view to be further down than to the end of the screen. Currently it can go way beyond that which is really frustrating. Relevant code: public boolean onTouch(View…
Carl
  • 249
  • 2
  • 5
  • 13
0
votes
0 answers

How to trace dispatching of MotionEvent

Is there a way to trace the dispatching of a MotionEvent through the view hierarchy? I have a case where I'm clearly tapping within the rectangle of a TextView (evident when I enable my device setting for: developer options - pointer location) but…
Peri Hartman
  • 19,314
  • 18
  • 55
  • 101
0
votes
0 answers

Get MotionEvent object using Application only

I'm developing a library for Android, that you can integrate in your project and using it passing only an instance of an Application of your project. So, the question is: Is there any way to get MotionEvent object (to get X and Y of users touch)…
Demigod
  • 5,073
  • 3
  • 31
  • 49