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

Java/Android: Continuously rotate ImageView image on tap of left/right side of screen

I'm currently making a Java Android game and I want to rotate a car image left/right as long as the left/right half of the screen is pressed (respectively). I couldn't seem to find any help elsewhere for this, and I have no code to show, I don't…
dumpong
  • 151
  • 12
2
votes
1 answer

How do I make same ImageView recognize a swipe and single tap event?

When there is onclick, ontouch listeners attached to same ImageView, touch has priority over click. I want an ImageView react to 2 different moves: swipe and single tap. How do I do this? right now, i do this: swipe_area.setOnTouchListener(new…
ERJAN
  • 23,696
  • 23
  • 72
  • 146
2
votes
1 answer

Detecting Swipe and Tap gestures

How to detect Swipe and Tap in onTouch method? I want one of two actions to be executed when I swipe and other when I just tap. Need to know how to dell the difference between tap and swipe. Here is my code: @Override public boolean onTouch(View v,…
jelic98
  • 723
  • 1
  • 12
  • 28
2
votes
1 answer

Select and place different shapes in canvas using OnTouch event

I am new to android programming In my project layout, I need created Color palette which is in grid layout(I put some buttons and set color background). Shapes(Triangle,square and circle which are buttons as well) is in Linear layout Next to these…
2
votes
1 answer

Custom Button Doesn't work with OnTouchListener

I have a problem with OnTouchListener. I created a custom button. This button properly works with onClick event. But it doesn't work with onTouch Event This is my custom button. I want only two options just button and button_pressed.
user2852142
2
votes
2 answers

how to skip switch.setOnCheckedChangeListener when status is not updated by user

since i am trying the switch first time (new to android) i am not sure how to handle this issue. i have a switch on an activity and an attached setOnCheckedChangeListener() to it. when the activity's oncreate is called i make an async call to…
2
votes
0 answers

setImageResource disturb onClickListener - android

I have an activity which get a reference to a specific ImageView inside a layout. I want that whenever this button is clicked, it will bring up a chooser which will give the user the ability to choose which app he would like to use to share this…
David Lasry
  • 1,407
  • 4
  • 26
  • 43
2
votes
1 answer

ListView onTouch MotionEvent

I have a list ListView. Wrote a handler for it touches. When you touch the menu item (ACTION_DOWN) I'm highlighting it. When you release the item (ACTION_UP) - returns the original color. The problem is that if you touch and scroll - and then the…
T_E_M_A
  • 560
  • 1
  • 11
  • 28
2
votes
0 answers

Use onTouchEvent and onclick event together

I'm having trouble with enabling buttons while the onTouchEvent is active. In my app the user is supposed to press anywhere on the screen to see a text and while pressing the screen press a button. The problem is that while the onTouchEvent is…
1
vote
1 answer

How to implement list sort function with touch event in javascript? (Drag & Drop)

I am implementing a list sort function in React with Drag & Drop function. However, my code works normally with the onDrag event on the web, but it doesn't work at all with the onTouch event. My web application is for mobile devices, so I don't know…
김정수
  • 611
  • 4
  • 9
  • 22
1
vote
0 answers

Does a bodiless function in JavaScript prevent the default of an event?

I set the "passive" Parameter of a touchmove event to true and therefore can't call e.preventDefault() inside the function. But I need the function to prevent the default behaviour of the touchmove event when a certain condition is met, so I…
MMF
  • 33
  • 7
1
vote
1 answer

Touch event.getAction does not work under service class in android studio

I developed an App to collect touch events under the foreground service class. The app has a main activity to input user's information (e.g., name and age). Then a foreground service starts to collect touch events, and a notification is launched to…
Mohsen Ali
  • 655
  • 1
  • 9
  • 30
1
vote
2 answers

How to listen the number of touches?

I thought it's easy. Like always //somewhere inside constructor overlay.addOnTouchListener(this) //... override fun onTouch(v: View?, event: MotionEvent?): Boolean { event?:return false if (event.actionMasked ==…
undefined
  • 623
  • 7
  • 27
1
vote
1 answer

How to detect swipe between views to make path across them in android java?

I am trying to make game for which there are buttons with alphabets and if user swipes over them then it should detect the views as well as make a line across them. I searched many tutorials, examples and questions but unable to get the idea. I have…
Bishwash
  • 854
  • 1
  • 9
  • 22
1
vote
1 answer

onclick event don´t works in mobile devices

I use this simple code for when click in div, check input checked, and also change color when i do click over div My code :