Questions tagged [ontouch]

OnTouch is called when a touch event is dispatched to a view it allows listeners to get a chance to respond before the target view. It gives a motion event.

274 questions
2
votes
1 answer

Android Button onTouch(), if return true, has no click animation effect; if return false, has clik animation effect

I observe this weird behavior, please help me figure it out! I simply set a onTouchListner to a button. For the onTouch() callback, if I set it return false, when I click on the button, I can see the click animation effect of the button (simply…
2
votes
0 answers

changing image with imageswitcher and onTouch

I want to make android app like the following site. https://sectional-anatomy.org/ct-abdomen/ or like https://radiopaedia.org/cases/squamous-cell-carcinoma-oral-cavity There are multiple pictures and these are changing by scrolling. I have done…
2
votes
1 answer

Efficiently Drawing over an imageView that resides inside of a fragment in response to a touch event

I have an application in which I display an image in an ImageView that resides in a fragment seen from the activity. I would like to respond to touch events on the ImageView by drawing small dot-like circles centered around the coordinates of the…
Uri Greenberg
  • 152
  • 1
  • 11
2
votes
0 answers

Image Zoom while onClick and onTouch perform toghether

I am performing onClick and onTouch on same ImageView and handle it with the use of gestureDetector which work fine. Open Gallery on onClick and set selected image on ImageView and after that image move,zoom in,zoom out etc.. perform.But issue is…
2
votes
0 answers

How to propagate MotionEvent but still receive all event coming after ACTION_DOWN in Android?

I'm working on an SDK in which I set an OnTouchListener to 2 different views from two different classes that each one of them needs to handle the same touch events for its purposes. Until now I only needed the ACTION_DOWN event in one of them so the…
Emil Adz
  • 40,709
  • 36
  • 140
  • 187
2
votes
2 answers

Android onTouch() method doesn't work (swipe detection)

I'm programming Snake on Android with Android Studio 2.3.2 And in order to move the snake i've made an onTouchListener to detect if the user is swiping and in which direction (North, South, East, West) In the following is the onTouch method of…
Urbs
  • 131
  • 9
2
votes
1 answer

Ontouch event while talkback is enabled in android

I am quite new in android. I have a problem in handling touch event while talkback is enabled. I am testing on android 6 ,galaxy S6: First:I have activated Voice support on the device (Settings\Accessibility\Vision\Talkback). second : On the page,…
mary
  • 369
  • 1
  • 5
  • 16
2
votes
0 answers

How to detect a long touch (over 2 seconds) on Android

I have a custom view and I want to detect when a user has been pressing/touching the same spot for over 2 seconds. I have been using an onTouch event to detect when the user first touches the screen and then see if he is still touching the same spot…
skbrhmn
  • 1,124
  • 1
  • 14
  • 36
2
votes
3 answers

OnClickListener and OnTouchListener collision issues

Currently working on an app in which I implement a chat head to make a view on top. I use an image for floating icon for chat heads, it working fine. what problem I face is that, both onClick and onTouch event not working properly either one of them…
baldraider
  • 1,049
  • 2
  • 18
  • 48
2
votes
3 answers

Trying to PlaySound onTouch, getting crash. Android

I'm new in android programming and now I'm trying to do my homework. I read all the similar topics here, but it looks like I'm missing something. I need to play some wav sound from raw folder using onTouch for my button. Here's my code. import…
2
votes
1 answer

Java Android onTouch Direction

I am trying to develop a simple game wherein I need to throw a bullet . I would like the ball follows the touch, or swipe direction. However, I have a small problem that I have not had success in solving. I take coordinates on the ACTION_DOWN of…
2
votes
1 answer

Why does the worker thread get stuck in loop when the button is released?

I am trying to write a message to stdout in android every second for which a given button is held(I intend to place a method there later). I use switch in a standard onTouch method to detect button press: protected void setFab(FloatingActionButton…
2
votes
1 answer

How to handle multitouch events in Android with multiple nested layouts?

I am designing an Android application and I would like to find a way to handle multitouch between multiple nested views. My layout is as following: Relative layout | |---Linear layout | \---Linear layout | \--Button A | |---Linear…
Alexis Clarembeau
  • 2,776
  • 14
  • 27
2
votes
2 answers

control multiple buttons with one swipe gesture swift

I have array of UIImageView that printed on the main View (as subviews) in a matrix. That UIImageViews interact while I am tap on them (work like a pixel when I touch one of them it turn on (move from black to green) but I want to do it with swipe…
2
votes
1 answer

Comparing MotionEvent.getX() with screen width in Android

I've created an OnTouchListener for motion events in an activity, and I want to find where they happen relative to the screen. I can use event.getRawX() to find the x co-ordinate, and similarly windowManager.getDefaultDisplay().getMetrics(new…
shinyford
  • 29
  • 10
1 2
3
18 19