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.
Questions tagged [ontouch]
274 questions
1
vote
1 answer
Find the String value of a selected img created dynamically
Ok so I have dynamically created Images. the images are random. what i want to do is to identify what is the string name of the img because i want to compare the string name to something i created dynamically as well. this must be implemented on…

Mark Ligot
- 67
- 7
1
vote
0 answers
detecting touch event on rectangle in android
I Writing a very simple game in android , the game is like touching a shapes (like rectangle,circle,arc...) and for doing this i write a Thread MainGameTread.class:
package com.example.komeil.surfaceview_2;
import…

komeil shahmoradi
- 181
- 4
- 16
1
vote
1 answer
Android Canvas OnDraw Touch Listener for Rotated Text
I have a Canvas Text is drawn using drawText Method with Rotation of -45 degree, what i need is a touch action for that Text part alone, the ref image is below,
My Code is below
@Override
protected void onDraw(Canvas canvas)
{
…

Brendon
- 1,368
- 1
- 12
- 28
1
vote
0 answers
Android Studio OnTouch always gets user's touch location
So, I want the image to move partly out of the screen but it doesn't. It always picks up where my finger is touching the screen. I tried doing other calculations but I can't do it. Is there a way for me to move the image out of the screen for all…

user6345865
- 53
- 7
1
vote
1 answer
Android OnTouch swipe up/down direction change
I'm trying to detect when an swipe direction was changed while the user still swipes on the screen.
I have something like this (very basic) for detecting the swipe direction:
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
…

Ionut Negru
- 6,186
- 4
- 48
- 78
1
vote
1 answer
Libgdx Sprite not moving smoothly
I am having a problem where when I go to move my sprite it stops and I have to press again for the sprite to move again.
What I want is when the user holds their input down the character keeps moving in the inputted direction, instead of what is…

Phil3992
- 1,059
- 6
- 21
- 45
1
vote
1 answer
Android Studio GridLayout onTouch Event
I want to create an App where I can change the color of the gestures of the GridLayout.
My_GridLayout
It works good with the following code:
@Override
public void onDraw(Canvas canvas) {
if (touchOn) {
canvas.drawColor(Color.RED);
}…

MFC_Starter
- 173
- 1
- 2
- 11
1
vote
0 answers
Why can't I execute both onClick and onTouch simultaneously?
Disclaimer: I have already tried following similar threads (namely How can I use OnClickListener in parent View and onTouchEvent in Child View? and How can i get both OnClick and OnTouch Listeners), yet my code still fails to work.
I have a (parent)…

Sazu
- 11
- 5
1
vote
1 answer
creating onclick with ontouch event
May be this is a repeated question, if it is kindly direct me to it.
I have linear layout with a textview inside and on click of that linearlayout i want to change the background of linearlayout and text color of textview
Layout not clicked
Layout…

user3024990
- 61
- 3
1
vote
1 answer
Difference between Click, Touch and Gesture in Android?
I am new to Android developing and there it is not very clear to me the difference between the Click, Touch and Gesture classes in Android.
Is on the generalization of the other?

FVbes
- 21
- 1
- 4
1
vote
1 answer
Wrap content doesn't wrap it's content when the picture is cropped
I'm using this to crop an image and then i load it to this imageView:

Amir Heshmati
- 550
- 1
- 8
- 19
1
vote
0 answers
Prevent redraw after onTouch event on view
I have a view in my android app that displays a graph.
The problem is, the graph redraws itself at the end of the onTouch event. There's not function call in the onTouch event handler that would explicitly do this. When I debug to the end of the…

user1423857
- 73
- 9
1
vote
0 answers
How to handle with onClick and onTouch events in Android?
I want to implement a floating window function in my app which will respond on user input:
1.When user click the floating window, my app will take a screenshot of the current display and save it to the /sdcard directory. During this process, the…

Pan.
- 67
- 10
1
vote
1 answer
Camera setRepeatingRequest issue, it is working only once and after it has no effect
i have a camera app, where i focus on touch, but the problem it is that after i set AF and AE Regions and after i trigger the focus, i set the setRepeatingRequest() so i can see the preview, but it works only for the first time i touch the screen…

Homombi
- 133
- 7
1
vote
2 answers
Why does my countdown timer not run to the end sometime?[android]
I m doing counting on how long the button was pressed right after ACTION_DOWN, depending on how long it was pressed - I respond to the press differently in ACTION_UP.
The problem is that when i do action_down(press), it does not count down to the…

ERJAN
- 23,696
- 23
- 72
- 146