Win a copy of Java Challengers this week in the Java in General forum!
  • 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
  • paul wheaton
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • Mikalai Zaikin
  • Himai Minh

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
 
Rancher
Posts: 534
6
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?
 
reply
    Bookmark Topic Watch Topic
  • New Topic