Questions tagged [ontouchlistener]
Android interface to define a callback to be invoked when a view is touched.
1,429
questions
0
votes
0
answers
27
views
How can get x y position of bitmap inside imageview?
How can get x y position of bitmap inside imageview?
image view type is matrix.
after rotate imageview how can i get correct x, y coordinate from imageview
if (selectView.mode == selectView.DRAG) {
...
0
votes
0
answers
19
views
setOnTouchListener in PhotoView library in Android Studio
I'm using the PhotoView Library to zoom a image in my activity, but I want to use the setOnTouchListener and onTouch method to change the image if I touch in certain area of the screen.
The main ...
0
votes
0
answers
11
views
Error set color button use state_press when when pressing 3 buttons at the same time in android
I have built a layout of 3 buttons, and I have set the colors for those 3 buttons to be in the default state and the state when pressed, everything is normal except that when pressing those 3 buttons ...
0
votes
1
answer
29
views
Why is my soundpool behaving differently in these 2 situations? (The value soundpool.play assigned to stream is never used)
I want to play a sound when the user touch the button and have the sound stop when the finger is lifted. This is my trial code which works as I wanted:
public boolean onTouch(View view, ...
0
votes
0
answers
11
views
Is it possible to only consume onSingleTapConfirmed event in Android?
I have 2 touch listeners attached to the child and parent views. The child view would handle onSingleTapConfirmed while parent view would handle all other events like scroll, fling, double tap, etc. ...
-3
votes
1
answer
94
views
Why does this program crash when I try run it?
I have a basic understanding of Java, but am completely new to Android Studio. I tried making a program that increases a counter when a button is held down. I based it on two bits of code I found (...
1
vote
0
answers
56
views
How to make a smooth rotation during a continuous swipe on Android using Kotlin?
I have a circle as ImageView and I want to be able to smoothly rotate it when swiping with a finger. If I swipe slowly, I want the circle to rotate slowly until the swiping action stops. If I swipe ...
1
vote
1
answer
25
views
Android: OnClick margin space in RecyclerView.Adapter
I want to execute some action if user click the space(created by margin) between two items in RecyclerView, however I did not found a way to do that. OnTouchListener might do the trick but it is ...
0
votes
0
answers
13
views
Maximize View.OnTouchListener sample rate?
When a View.OnTouchListener() is receiving MotionEvents (including historical ones that occurred since the last call to onTouch()), does Android (13) capture samples at the highest rate the phone's ...
5
votes
1
answer
344
views
SimpleOnGestureListener.onScroll receives a null value and crashes
I'm using a gesture detector to capture scroll events from a scroll view:
val gestureDetector = GestureDetector(this.fragment.activity, ScrollGestureListener(scrollView))
scrollView.setOnTouchListener(...
0
votes
0
answers
45
views
How to properly capture/consume onTouchEvent in both child and parent view?
I have a LinearLayout , and there's an ImageView inside the layout with some margins. I need to conditionally consume the ACTION_UP in ImageView by returning true. I also need to handle touch events ...
0
votes
1
answer
26
views
Should the onTouchListener call the same method multiple times when Tapped?
This is my first game app. I've built a card game, players can tap or drag a card. I've noticed that when a player taps a card, it appears tha the onTouch method fires multiple times. My basic code is ...
4
votes
0
answers
301
views
OnTouch and OnClick Conflict : Parameter specified as non-null is null: method kotlin.jvm.internal.Intrinsics.checkNotNullParameter, parameter e1
I have a Recyclerview and that allow user to change scale by swipping up, I use the gestureDetector and onFling for this, this works fine, but then the user should able to click on an Item of ...
0
votes
1
answer
63
views
How to handle onTouchListener inside a RecyclerView
I need some help how to solve my problem. I have a recyclerview and its items contain an ImageView. I wanna move imageview with my fingers. I create a touchListener and set it in the adapter for the ...
0
votes
2
answers
468
views
Handling button click and button touch simultaneously in Kotlin
Here is some seemingly classical code, that I have in a small android app.
It is handling some button, so nothing special going on; but this is the question:
This code work as long as I choose to have ...
0
votes
0
answers
32
views
How to implement both setOnClickListener and onTouchListener to a single CardView?
I'm a novice and this is my first Android app. I'm building a card game where the player should be able to tap to move a card (onClick) and also drag a card to a new location (onTouch).
I'm using ...
0
votes
1
answer
35
views
Android studio SurfaceView onTouchEvent
I have a SurfaceView in my activity xml and I want to get some informations when the SurfaceView is clicked. For that I have a class like below
class ImageTable extends SurfaceView implements ...
0
votes
2
answers
164
views
Increase value of text when button is hold
I have a plus and min button that work when pressed. Now I want to make them when you hold/press it down it goes up/down more then 1 at a time.
This is one of my regular buttons:
plusBtn....
0
votes
0
answers
54
views
Selecting or Hovering multiple buttons and change colours in ANDROID
Hi I am quite new to android and I'm trying to make some word game, and i have no idea how to change the button colours when I click and drag.(I dont even know if this is the right way to say)
The ...
0
votes
0
answers
104
views
Android(Kotlin) - I need to make my ImageView have a min and max size when zoomed and that the drag only when it is zoomed
The code works correctly to enlarge and minimize an ImageView, the problem is that I can make it very small or too large without any conditions, and I can't find a way to put conditions on it so that ...
1
vote
0
answers
69
views
How to get X,Y position in android?
I am beginner to android and I am asking to make sure.
Is there any possible way to get fixed X,Y position for all devices?
I need to get fixed point dimensions where the screen is touched.
From what ...
0
votes
0
answers
18
views
Android Composables: How do I ignore scroll events in a LazyList for certain items?
I have this:
LazyColumn {
item {
Map(
modifier = Modifier
.fillMaxWidth()
.height(460.dp),
...
0
votes
1
answer
160
views
Highlight item in RecyclerView while Pressed
I can't seem to find a simpler way to only highlight a RecyclerView item when pressed but while this code I have come up with seems to work ok it will remove the highlight (ACTION_CANCEL occurs) if I ...
0
votes
0
answers
136
views
Swipe whole recyclerview from right to left not single item
I want to animate whole recyclerview from right to left and not single item. On animating i want to show textview from each row. i had tried implementing touch listener but not working. anyone has any ...
0
votes
1
answer
42
views
onTouchListener ACTION_MOVE not working with more than 1 finger
I'm building an OpenGL ES app and I use an onTouchListener to detect touch events, as suggested by the android development website (https://developer.android.com/training/gestures/multi#java). I then ...
1
vote
0
answers
86
views
How can I apply a scroll/fling gesture to a VideoView
I'm trying to make a scrollable VideoView. I want the scroll gesture of the user to make the videoview progress smoothly. I hope that makes sense.
I've tried to apply an OnTouchListener to the ...
0
votes
0
answers
38
views
How to make custom view call both its touchEvent and its parent's?
I'm currently working on a project where I have a custom view (graph). It is located inside a RecyclerView which is inside a NestedScrollView. My GraphView has an onTouch event that allows to see ...
0
votes
0
answers
164
views
Detecting a long Press on Item of RecyclerView Adapter
i am using OnTouchListener in Item of RecyclerView.i detect Long press and MotionEvent.ACTION_UP.
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
imageLoader.displayImage("...
1
vote
0
answers
117
views
OnTouch Rotate View Issue
i have a problem with rotating when i touch the rotate button and swipe right and left like normal rotate it will work fine but if you move your finger inside the layout container it will keep ...
0
votes
0
answers
53
views
onTouch() not called when dragging item
I am trying to drag a recyclerview item after long pressing it to activate dragging. However, the onTouch() of the parent layout of the recyclerview item is not being called. I read from a post also ...
2
votes
0
answers
85
views
Android getLocationOnScreen returns incorrect point after the view rotation
I'm using getLocationOnScreen() from Android SDK for getting the location point.
when I rotate the View using gestures I get the wrong point.
Has anyone already encountered such a problem?
1
vote
2
answers
122
views
fragment setOnTouchListener not triggered
I have the following kotlin code, and I can't get the onTouch\click listener called.
I am using an emulator and i click the fragment many times in many places and nothing seem to get the listeners ...
0
votes
1
answer
198
views
android ontouch on listener on layout wont fire when clicked on a child element
I am setting an onTouchListener on a linear layout and on touch of the layout user can drag the layout around the screen and reposition the layout. This works fine, but now i have some ImageViews ...
1
vote
0
answers
56
views
How to handle touch events on a parent view?
I have a layout as :
LinearLayout
TextView
TextView
I want to look for gestures on the parent layout i.e. LinearLayout. But failed to do so.
Here is what I have tried :
mll1....
0
votes
1
answer
55
views
Multitouch between different views on diffrent apps on android, ACTION_POINTER_DOWN not trigger
ACTION_POINTER_DOWN works fine when I multitouch on the same view.
But when I multitouch on diffent apps, ACTION_POINTER_DOWN do not trigger.
one app is developed by myself, and the other is not.
So i ...
0
votes
1
answer
43
views
OnTouchListener doesn't record ACTION_UP when navigating to another fragment
While holding down button with one finger and I navigate to another Fragment with a different finger, MotionEvent.ACTION_UP doesn't fire after lifting my finger in the next fragment or at all.
view....
2
votes
0
answers
46
views
Trigger OnClickListener and OnTouchListener separately
In my Recyclerview I have a list of items. When I click and hold, I want to display a Dialog and dismiss it when I release it.
When I just click on the button I want to open a new Activity. With the ...
0
votes
1
answer
140
views
How to make a half view not clickable
Hey and sorry for my bad English...
I have a ListView in my ListFragment with a custom Adapter.
In my Layout I have an Button. The Button and the whole item/row is clickable. I made that happen with
...
1
vote
2
answers
89
views
Writing function for onTouchListner, when Imageview held for more than 2 seconds?
I am working on a app to unlock a door by sliding an Imageview upwards and holding it for a a few seconds. I have designed a layout in a ConstraintLayout Layout.
<androidx.constraintlayout.widget....
-1
votes
1
answer
59
views
How to add onClickListener for a button after keep clicking on it for a while? [closed]
Hi guys i'm a beginner android dev and i have a question that i didn't find it answer yet. I want to add an onClickListener for a Button after keep clicking on it for 1.5 seconds for example?
2
votes
1
answer
265
views
ImageView - get color of touched pixel
I have following image, consisting of three colors (white, grey, black):
<ImageView
android:id="@+id/iv_colors"
android:layout_width="match_parent"
...
1
vote
0
answers
343
views
Android Studio - how to drag and drop ImageView in an accurate position
so I made an app that draws bitmap into canvas as a template, and I want the user to be able add images from gallery then scale, position and rotate. currently stuck in positioning the imageView ...
0
votes
1
answer
107
views
How to detect a long touch to the screen of an android smart watch?
I basically want to detect a long touch to my frameLayout, once detected I'll call an alert message that I have in a method.
frameLayout.setOnTouchListener(new View.OnTouchListener() {
...
0
votes
0
answers
193
views
Android get global android user interaction listener
I have a app which sends intent to a pdfviewer whenever a button is clicked.
Now my app is like a KIOSK app and one of its requirement is that whenever user leaves android/ do no interaction with it ...
0
votes
1
answer
168
views
How do I count the number of times I tap the screen with onTouchListener?
I'm using a wearable device and I'm making an app for it. I have a timer and some other things that begin when I click a start button. Thing is the start button occupies some space that makes things ...
0
votes
1
answer
116
views
how to use OnClick,OnLongClick And OnTouch On Same View In android?
i am developing android app in which, need to implement OnClick,OnLongClick And OnTouch on same view then searched lot and at the end got the result which i am sharing with you with example.
0
votes
0
answers
100
views
How to scroll a RecyclerView below a View without clicking on an item of that RecyclerView
I have a layout where a RecyclerView occupies the entire screen and a CardView is at the bottom of the screen, over the RecyclerView.
The CardView is not clickable. I do not want the RecyclerView to ...
0
votes
1
answer
49
views
Im not Getting the Button Release Toast in OnTouchListners
The issue is im not getting the Button release Toast.
i've a simple view in xml on which im performing onTouch.
hidenBtn.setOnTouchListener(new View.OnTouchListener() {
@Override
...
0
votes
1
answer
118
views
Android on touch listener inside an item click listener
I have a list view with items and every time I click on a List Item , I need to know if I have touched the left side or the right side of the screen. In order to accomplish this , I have coded the ...
0
votes
1
answer
429
views
Android enable/disable spinner touch listener at condition
I have an activity with a Spinner (with his own adapter) and another Adapter that manages the recycler view with its list . I'm trying to implement the following logic : when the list of the recycler ...