Questions tagged [android-touch-event]

For questions about detecting, handling and responding to touch events in a view, in the Android platform.

Use this tag for questions related to detecting, handling and responding to touch events in a view, in the Android platform.

Documentation:

190 questions
3
votes
0 answers

Preventing a NestedScrollView from scrolling parent NestedScrollView?

I have a NestedScrollView(NSVchild), inside a horizontal RecyclerView, inside another NestedScrollView(NSVparent). Inside NSVchild is a TextView with long texts. What I want to know now is, how can I prevent NSVchild from scrolling NSVparent, when…
3
votes
2 answers

android: how can I detect when user touch left 20% of view area?

In an activity by using public boolean dispatchTouchEvent(MotionEvent ev) how can I know an user is touching left Y-axis of 20% edge area? It should be generic and orientation handled. I don't want to create any hidden view on that.
DayDayHappy
  • 1,679
  • 1
  • 15
  • 26
3
votes
0 answers

Prevent paging/swiping in cascaded ViewPager while handle scrolling of contained RecyclerView:

I have a ViewPager with 3 Fragments contained in it. One of the Fragments contains another ViewPager. which makes it a cascaded ViewPager inside a ViewPager. I need to prevent the inner ViewPager from swiping/paging while allow it to pass the scroll…
3
votes
0 answers

Edittext call afterTextChanged only if user modified it and not the program

I am new to android and having some trouble with this method and wondering if someone can assist with this. Question: I have an array adapter with EditText box that the user can modify in the ListView. But, I only want user modifications and not the…
3
votes
1 answer

How can I customize the selected tab indicator in a TabLayout?

I would like to change the selected tab indicator of a TabLayout, with a custom icon, that should follow the same behavior (as the user slides towards the next tab, the icon moves accordingly). There's no default method in the class since you can…
3
votes
1 answer

Android tracking touch event after new activity starts

In my application, a new activity starts on touching a button (not click) and further I don't lift the finger and wish to track the motion of touch after that in new activity. The on touch listener in second activity does not respond to this…
Swati Garg
  • 995
  • 1
  • 10
  • 21
2
votes
1 answer

What causes "getHistoricalRawPointerCoords: Invalid historical index 1 for MotionEvent" on Android 13 devices?

The following crash is rare but it does happen on different devices: [libc.so] abort SIGABRT Thread: getHistoricalRawPointerCoords: Invalid historical index 1 for MotionEvent { action=UP, id[0]=0, x[0]=810.527, y[0]=1609.98,…
Hong
  • 17,643
  • 21
  • 81
  • 142
2
votes
0 answers

Detecting touch on both child and parent simultaneously without override methods

I have a parent ViewGroup and a View added as its child. This setup resembles my original application where I have an image. If I pinched on the image, its parent should handle the pinch. I need to detect tap on the image as well. I have added…
Navaneeth
  • 102
  • 9
2
votes
1 answer

"Parameter specified as non-null is null" when using GestureDetector.SimpleOnGestureListener() onScroll() function

I am using the GestureDetector.SimpleOnGestureListener() to react to UserGestures and expand a BottomSheet. The problem is that a small percentage of the users experience the following crash. ( stacktrace stripped to make the question more…
2
votes
0 answers

How to perform touch gestures to other apps in android

I have an android application required to perform touch gestures in entire android device and not just my own application I found these solutions: Using adb Commands ROOTing Android Device Accessibility Service in Android 7.0 or higher Is there…
ET1992
  • 151
  • 9
2
votes
0 answers

How to catch that finger still on button if there is no movements?

I am using OnTouchListener() and I wanted to know if there are any options to catch that finger still on the button, in ACTION_MOVE mode when the finger is not moving. I mean I understand that ACTION_MOVE triggered almost constantly. But when I…
KeitL
  • 188
  • 2
  • 13
2
votes
0 answers

Propagating touch events

I have trouble implementing something like Instagram preview image feature (on long press show dialog with enlarged image). So i have Fragment with ViewPager as its child. Adapter responsible for feeding the data to theViewPager has one imageView…
2
votes
1 answer

OnClickListener triggered for all Custom Views inside a FrameLayout

I am adding Custom Views to a FrameLayout programmatically: public class CustomView extends View { .... @Override protected void onDraw(Canvas canvas) { ... //Doing stuff here } } -- containerLayout = (FrameLayout)…
2
votes
1 answer

Open an activity in a touch way android

In my first activity touching left or right opens the second activity Of the value calculation X and Y The activity is opened based on the conditions. This is part of the code case MotionEvent.ACTION_MOVE: if (v.getId() == R.id.layout3) { …
2
votes
2 answers

onTouch() not called for parent layout

I have a layout like this: LinearLayout RelativeLayout(id = test) FrameLayout (From a LIB. id = lib) I tried to add onTouchListener() to test but it doesn't work. I tried: @OnTouch(R.id.test) public boolean test(View v,MotionEvent e) {…
1 2
3
12 13