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

Is there a limit (time or number) for the historical MotionEvent's?

I have overwritten my methode dispatchTouchEvent of my activity to grab the MotionEvents (just added some logging). I observed that the getHistorySize() methode don't have a size of 1-2. Is it typical , that the "historical" events of a Motion…
Ghali
  • 275
  • 3
  • 15
0
votes
1 answer

Android Motion Event

I am trying the android motion event. However, I do not know why it cant go to > case MotionEvent.ACTION_MOVE: Here is my codes. @Override public boolean onTouch(View v, MotionEvent event) { int action = event.getAction(); switch (action){ …
Sam
  • 1,252
  • 5
  • 20
  • 43
0
votes
2 answers

Can I get coordinates x y of the position where I tap? OnTapListener?

I've been searching for some function that can give me x,y coordinates of the the point where I touch on screen. I got a code of onTouch() but couldn't find a way to call that function. public boolean onTouch(View v, MotionEvent event) { int x =…
0
votes
2 answers

Send data to arduino as long as the button is being pressed

I want to send data to an arduino mega 2560 as long as a button is being pressed and when that button is released it will stop sending informations. I am using onTouchListener with MotionEvent constants. But when I run this on my phone I press the…
0
votes
2 answers

Check Button Leave, Android

Here is the problem... What I Try to do : I have a button in my Fragment, the user presses it. And I would like to know when user's finger moves out of the button. What I have managed to do : private Button btn; @Override public View…
Fundhor
  • 3,369
  • 1
  • 25
  • 47
0
votes
0 answers

Motion event has invalid pointer count 0 >> On opening/ closing/ selecting in Navigation Drawer

I get this error if I do anything with my navigation drawer. Motion event has invalid pointer count 0; value must be between 1 and 16. This error doesn't crash my activity. But just floods my log. Below is the activity. The adapter is custom…
suku
  • 10,507
  • 16
  • 75
  • 120
0
votes
0 answers

How to drag image after zooming it??

I followed a simple tutorial on how to zoom an image. The problem is i can't drag and scale the image after zooming it. i did read android Dragging and scalling and tried other answers but it doesn't work. below is the code for zooming in the image.…
0
votes
1 answer

How do I make an image(drawable) follow my finger?

I have this class which extends SurfaceView. The code that I have so far makes the player follow my finger, but it also allows the player to "teleport" to wherever the finger goes and I do not want that. @Override public boolean…
0
votes
1 answer

New image on user touch

Hi I am a newbie in android. My question is is there any function to display an image from drawable into screen. By the way I am able to move the same image on the co-ordinates I touch, I just need the new image to be placed on the co-ordinate i…
0
votes
1 answer

MotionEvent.ACTION_UP and/or ACTION_MOVE not always firing

I have a ScrollView with a series of linearlayout textviews. When the user "touches" one of those textviews, I am temporarily changing the background color to "show" the touch so they can visually confirm the item they touched. When they lift…
Peter
  • 427
  • 4
  • 14
0
votes
1 answer

Android : hide/show footer/header as scrolling scrollview down/up

I am trying to implement a way to have my footer slide away down and my header to slide away up while user scrolls down the scrollview. And vice-versa, as the user scrolls up the scollview, I want my footer to slide in from the bottom and the…
Mackovich
  • 3,319
  • 6
  • 35
  • 73
0
votes
1 answer

Too many AsyncTask's with UDP (DatagramSocket) throwing Exception when executed

I'm having a problem with my "Remote" App. What i want to do is to use my phone as a touchscreen to control the mouse cursor of my PC, which works so far, with the small problem that after moving the cursor around too much, i get an Exception. The…
Arekai
  • 3
  • 1
0
votes
0 answers

MotionEvent MOVE never fired

I'm trying to disable swipe in certain direction in my viewpager using Xamarin. So I define a custom viewPager and override OnInterceptTouchEvent method to check gesture direction. My problem is that my case MotionEventActions.Move is never fired,…
TGuerin
  • 345
  • 3
  • 18
0
votes
0 answers

Android RealtimeMultiplayer: Draw Line on opponent's screen

I'm having a hard time figuring this out. I'm creating a multiplayer game using the Google Play Games Service API. I want to draw a line on the opponent's screen. Therefore, need to broadcast MotionEvents. Only one player at a time is allowed to do…
MarcWho
  • 196
  • 2
  • 11
0
votes
1 answer

onTouch events in Fragment only registering scrolling

I am listening for onTouch events for my listView (custom PinnedSectionListView), but it seems to only register MotionEvents if I scroll up and down. I primarily need it to respond to taps. If I tap the cells, it does nothing. In my OnCreateView in…
Alan
  • 9,331
  • 14
  • 52
  • 97