• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Rob Spoor
  • Devaka Cooray
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Jj Roberts
  • Al Hobbs
  • Piet Souris

Android-RecyclerView OnFling gesture gets null MotrionEvent when combined with ItemOnClick

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


In the following code i have a recycler view with a custom adapter. Each item in adapter has onclick listener. Also recycler implements OnFling Gesture.

The problem
Each time OnFling gets called, the MotionEvent e1 is null. I found out this is because of the onItemClick implementation in adapter. It consumes the down click.

How can i solve this? I want to pass down to recycler the event, so the MotionEvent e1 to not be null.

MainActivity

Adapter
 
Bartender
Posts: 561
11
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Not really sure what you are trying to do with all of those actions, but you could possibly change the the type of listener you are using.  Maybe there's a listener that will handle both types of actions.  It seems like the problem is that there is one event for two listeners and one of them does it only?
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic