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

hold and release a button is not working in android

i have a button in android.If i hold the button a message should go and while releasing another message should go but Sometimes still holding a button also release is happening and release message is going. Here is my code for…
0
votes
1 answer

OnTouchEvent , my scene go back if i touch some place in scene

my question can be pretty strange, but I can not understand why my scene is moving back, if I touch the screen elsewhere, please help me figure it out. https://youtu.be/oKdwqn0HC0Y - in this video record my problem, To better understand the…
Vladimir
  • 11
  • 3
0
votes
1 answer

Imageview not following finger touch

I want to build an app that has an imageview and it simply follows the finger touch. In other words, the imageview follows the touch of the finger. I have partially achieved this, in the sense that the imageview is following the touch of the finger…
Ankit Shubham
  • 2,989
  • 2
  • 36
  • 61
0
votes
1 answer

ACTION_HOVER_ENTER event repeats previous coordinates

I have a custom view that overrides dispatchHoverEvent() so it can implement some support for talkBack features, it has the following code for testing: int action = event.getActionMasked(); switch (action) { case…
bluewhale
  • 181
  • 2
  • 9
0
votes
1 answer

How to play and stop sound by one button using Soundpool

I’m new one here and I’m kind of a new one in java. All my knowledge about code based on what I can find in web for my project. So in one hand I know some difficult stuff on the other hand I don’t know a simple things. Right now I’m stuck in this…
0
votes
1 answer

Pass MotionEvent ActionDown coordinates to inner class (AsyncTask)

as the title says, I want to be able to pass the coordinates given on ACTION_DOWN to the onPostExecute method of my AsyncTask inner class. I have been trying to do this for the past two days without success. How do I go about this? Any help is…
0
votes
1 answer

Get coordinates of ActionEvent

I got a little problem. In the following sample the first TextView has to show the type of MotionEvent-it works fine. The second TextView has to show the coordinates of the MotionEvent-but it doesn't work. I don't know why but maybe its only a small…
rcode
  • 49
  • 4
0
votes
0 answers

(Android) How to get MotionEvent.getRaw of other pointers

For get MotionEvent.getRaw of other pointers... I'm tried all event.offsetLocation(event.getRawX()-event.getX(),event.getRawY()-event.getY()); and void getRowPoint(MotionEvent ev, int index, PointF point){ final int location[] = { 0, 0 }; …
오재웅
  • 1
  • 4
0
votes
2 answers

Android - Disable scrolling while holding button

I'v got a Button inside a ScrollView. ...
0
votes
1 answer

ScrollView with ViewPager child not scrolling vertically

I have a ScrollView whose first child is a ViewPager. I need to disable the vertical scroll of the ViewPager so that it only scrolls horizontally and let the vertical scroll be handled by the parent ScrollView.
Alex Kombo
  • 3,256
  • 8
  • 34
  • 67
0
votes
0 answers

Android View.setOnTouchListener doesn't called in Fragment

How to get MotionEvent on touch from View? public class PhotoGalleryFragment extends Fragment implements View.onTouchListener { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { …
Shoxrux
  • 11
  • 4
0
votes
1 answer

How to find the touched and released positions of a view

I have a view inside a NestedScrollView. On swiping this view I have to find the swipe direction. Whether swiped up or down. How can I find this. What I tried is , I added OnTouchListener to the view , and I thought of finding the difference between…
user4489210
0
votes
1 answer

How to set Action in DragEvent

I am using OnDragListener to drag and drop image. i have MOTIONEVENT.ACTION_MOVE to implement image moving functionality. At a certain point in the action move, I want to end the drag and remove its shadow. Is it possible to set the action in drag…
android
  • 441
  • 1
  • 5
  • 17
0
votes
0 answers

Image View won't reappear after loading a new image from the URL unless I call onCreate(null). Why?

I'm not exactly sure what's going wrong here, but no matter where I try to force my imageview to be visible, it won't show up unless I call onCreate(null), which is a problem because it basically reinitializes my activity and all the live data is…
Remixt
  • 597
  • 6
  • 28
0
votes
1 answer

How to change properties of Views inside ScrollView while scrolling and triggered by scrolling?

I'm using a custom snapping ScrollView in my app. It extends HorizontalScrollView and overrides onTouchEvent(). This is used to snap the child Views in the middle of the ScrollView. There is also a leading and a trailing space which are wide enough…
EarlGrey
  • 531
  • 7
  • 29