2

I have a Fragment with the following layout: Layout

I want the RecyclerView that is highlighted to change when onSwipe left/right is called.

Is it easier to have the whole Fragment change? I have tried this method: Android: How to handle right to left swipe gestures with no success, i get the following exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'float android.view.MotionEvent.getX()' on a null object reference at com.apps.myshifts.OnSwipeTouchListener$GestureListener.onFling(OnSwipeTouchListener.java:40)

What is the easiest way to implement this?

Dimon
  • 194
  • 2
  • 14

1 Answers1

0

The easiest I think is to modify your adapter to make it work with multiple lists and when you swipe you clear the RecyclerView, bind the new Data then display it. It is a simple approach that would be good to achieve your goal. You might also try to add some animations to make it look smooth.

Rick
  • 1,146
  • 1
  • 20
  • 27
Daviid
  • 188
  • 6