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

The constructor intent is undefined

I am trying to pass "message" string to MainActivity using intent, I tried everything but still no luck. Can you help me through this. public class MoveMouse { public boolean onTouchEvent(MotionEvent event) { int eventaction =…
Navneet Singh
  • 11
  • 1
  • 3
0
votes
1 answer

Touchevent run false

The Game is, that the user tries to do a ball in a hole. 1. The touchCounter goes wrong, I want that the user only have 2 tries, when I run that code in my game the user have more tries, what is the mistake? final int MAX_TRY_COUNT = 2; int counter…
0
votes
1 answer

How can I implement more types of touches to ImageButtons in Android?

So I have a basic linear layout that consists of 6 ImageButton elements that stretch over the whole screen in a 2x3 grid. I want to make an app that works as follows: *1)*if any of the ImageButtons is short clicked, it will start another…
turor
  • 1
  • 1
0
votes
2 answers

Android multi-touch: Not detecting MotionEvent.ACTION_POINTER_DOWN

Here is a part of my code. I don't understand why MotionEvent.ACTION_POINTER_DOWN (a second finger touching the screen) isn't being detected. Can someone explain why this isn't working? Single player works fine. Two player (With multi-touch)…
James
  • 4,573
  • 29
  • 32
0
votes
1 answer

Moving properly an imageview inside a view

I am struggling a bit to move an image view properly. My layout has a linearLayout on the top of the screen, right below an edit text and then a view with my image view. When I touch the image, this goes down the screen and since that point I can…
Rafag
  • 719
  • 3
  • 11
  • 27
0
votes
1 answer

motionEvents didn't work Android Java

i can't get message in Logcat from events : MotionEvent.ACTION_MOVE and MotionEvent.ACTION_UP. I couldn't find solution for it so i ask it here. I have this overrided method in my class: @Override public boolean onTouchEvent(MotionEvent event){ …
user2899587
  • 189
  • 2
  • 3
  • 11
0
votes
2 answers

How to call a function only certain time

I have one EditText and one FrameLayout. I made it in a way where if the user drags within the FrameLayout, the background changes the color (RGB) based on the pixel from (X,Y) coordinate and also updates the EditText with the Hex value converted…
Si8
  • 9,141
  • 22
  • 109
  • 221
0
votes
0 answers

Timed display for graphic button on action_down MotionEvent

So I have spent a long time looking to see if there is a solution for this. Basically, the below code allows me to press on a button, when I press (action_down) the 'pressed version' of the button is displaying good, then when I remove my finger…
tm_forthefuture
  • 185
  • 1
  • 12
0
votes
1 answer

Collision with screen not working

I'm making simple pong game and I'm trying to make rectangle top stop moving left or right when it hits end of screen. I tried to do that with few Ifs in MotionEvent part, but its not working, it just gets off the screen like there arent any Ifs…
imot01
  • 97
  • 15
0
votes
3 answers

Bitmap that follows your finger instantly

I want a bitmap to follow my finger. But when I use MotionEvent.ACTION_MOVE the bitmap lags behind. Is there a way the bitmap follows instantly (or almost instantly) your finger? public boolean onTouch(View v, MotionEvent me) { // TODO…
0
votes
0 answers

Android Gestures: Translated and Rotated View returns to the original position when touch another View

i am using a project from codepanda "gestureimageview" succesfully, and i've got to move and rotate any View, but, when i touch another View, whatever, my rotated View is returned to the original position and with no rotation. In some cases i've got…
0
votes
1 answer

Android onTouchListener MotionEvent unwanted release

I have this code that performs action when I touch and release a button. But turns out it releases immediately even though i'm not releasing it yet switch (v.getId()) { case(R.id.turnoffall): if(event.getAction() ==…
yhunz_19
  • 1,206
  • 2
  • 12
  • 17
0
votes
1 answer

Convert RGB to X and Y in a bitmap

I have a code which takes a bitmap and converts the X and Y coordinate to RGB: int pixel = bitmap.getPixel((int)x,(int) y); inRed = Color.red(pixel); inBlue = Color.blue(pixel); inGreen = Color.green(pixel); How do I convert a given RGB and get the…
Si8
  • 9,141
  • 22
  • 109
  • 221
0
votes
1 answer

Cannot find symbol when replacing deprecated motionPressure to MotionEvent in Processing 2.0.3

I am following a book on "Rapid Android Development" with Processing 2.0.3 windows 7 64bit, having only api level 10 installed (android 2.3.3). The example I am at, uses "motionPressure" which was dropped by 2.0b7…
GANoob4eva
  • 13
  • 4
0
votes
1 answer

How to keep X and Y within layout's view ?

I have a FrameLayout which has a thumb image which the user can drag around. The thumb width is 10dp and height is 10dp. f = (FrameLayout) findViewById(R.id.fl); f.setOnTouchListener(flt); f.measure(MeasureSpec.UNSPECIFIED,…
Si8
  • 9,141
  • 22
  • 109
  • 221