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

Getting distance between android ACTION_DOWN and ACTION_UP events

I want to get the distance between the point where a user presses the screen (ACTION_DOWN) and where they release it (ACTION_UP). This is to be able to move the bitmap image the same amount (even if it gets pushed off-screen) without causing it to…
logicalfox
  • 83
  • 2
  • 13
0
votes
1 answer

how to protect the notification bar?

I want to detect the action based on the status bar. In fact I want to limit the right of this section. i tried mGrid.setOnTouchListener(new OnTouchListener(){ public boolean onTouch(View arg0, MotionEvent arg1){ …
diez
  • 125
  • 1
  • 5
  • 12
0
votes
0 answers

How can i calculate the degrees of an image after it stopped moving(android)?

I am quite new to Android programming. What I need to do is calculate the degrees of an arrow after it has stopped moving. I am using the following code: public boolean onTouch(View v, MotionEvent event) { //double xValue, yValue; …
Lunchbox
  • 1,538
  • 2
  • 16
  • 42
0
votes
1 answer

Android Cannot dispatch touch events to Spinner

I am writing an Android JUnit test that iterates through a list of MotionEvents and dispatches them to the Activity under test. For most events, I can just use the activity.dispatchTouchEvent(MotionEvent) method. For dialogs, I have to obtain the…
0
votes
1 answer

ImageView isn't visible and motion event isn't works well

i'm writing service class that has image overlay imageView overlay was visible, but it isn't visible after i added imageview resize code. Also, MotionEvent for resized imageview isn't works well Why imageview overlay isn't visible and MotionEvent…
0
votes
2 answers

MotionEvents not firing

Im trying to draw a square on a canvas but only the MotionEvent.ACTION_DOWN is run, and then the listener stops. The idea is when the user touches the screen it get the x1 and y1 locations and every time the onTouch is fired it must draw the rect…
string.Empty
  • 10,393
  • 4
  • 39
  • 67
0
votes
1 answer

Action_MOVE activate after Action_UP

I am creating a game , and I want my character turn left or right by Action_MOVE, but only after the user takes their finger off of the display. I have a class that detects whether MotionEvent is MOVE or UP.
ilbets
  • 710
  • 1
  • 9
  • 35
0
votes
1 answer

Pass only the tap gesture in ViewPager

I want to implement a non-scrollable ViewPager. People say that I should override the onInterceptTouchEvent and onTouchEvent functions: @Override public boolean onTouchEvent(MotionEvent event) { if (this.enabled) { return…
efpies
  • 3,625
  • 6
  • 34
  • 45
0
votes
1 answer

How to draw or write a text like MS-Paint in android using onTouch Event?

I have created panel with collection of different colors, pencil, eraser and different shapes similar to MS-Paint. I could be able to draw or write on a screen using Touch Event method. But when I draw something on a screen (when I touch the…
Achiever
  • 1,626
  • 10
  • 30
  • 54
0
votes
2 answers

ACTION_DOWN behaving like ACTION_MOVE

I'm creating a simple OpenGL 'app' to rotate a triangle. I wish, on the first touch, to save the angle the touch position corresponds to. Then, on motion, rotate the shape by the angle corresponding to current position minus angle of first…
Sam
  • 557
  • 6
  • 20
0
votes
1 answer

Android: Long touch on Button while MotionEvent.ACTION_MOVE

Ok... in my app i update the layout on MotionEvent.ACTION_DOWN and then i check the motion event coordinates to locate my buttons. I can show a toast when finger is released on different buttons. The problem is i need a long touch on my buttons to…
0
votes
2 answers

Motion Event for the Android

Whats the problem with this code? package com.evorlor.samplecode; import android.app.Activity; public class MotionEvent extends Activity { public boolean onTouchEvent(MotionEvent me) { int i = me.getAction(); switch (i) { …
Evorlor
  • 7,263
  • 17
  • 70
  • 141
0
votes
2 answers

Pass MotionEvent to GridView

Here is a summary of what i m trying to achieve. I have a view, on that view i m listening for MotionEvent. When it matches a specific condition, i would like to pass that MotionEvent to a GridView, in order to scroll. I m doing something like…
Mostrapotski
  • 425
  • 3
  • 11
0
votes
2 answers

player only moves when screen in ACTION_DOWN or ACTIONMOVE needs to move when being touched

ok to i created an ontouchlistener class: package drop.out.Game; import android.view.MotionEvent; import android.view.View; import drop.out.Game.Model.Player; public final class TrackingTouchListener implements View.OnTouchListener{ //player…
Russell Cargill
  • 270
  • 1
  • 6
  • 19
0
votes
1 answer

getHistorySize() always "0"

For ACTION_MOVE events, I'm obtaining the history size by calling event.getHistorySize() everything works perfectly on my Galaxy Nexus running Jellybean but on my LG Optimus 3D running Gingerbread, the history size is always "0". Does anyone know…