Design + Code an Android App from Scratch
This video introduces you to the RecyclerView.ItemTouchHelper class that lets you detect swipe and drag. Implement the ItemTouchHelper.Callback interface and override the onMove or onSwipe method to determine the actions that need to be executed when the item is dragged from one position to another within the RecyclerView or it is swiped. An alternate approach is to use the ItemTouchHelper.SimpleCallback where you can minimally define the behaviours that you want to support inside the RecyclerView. Use the makeMovementFlags method to specify the direction of drag or swipe. Override the isLongPressDragEnabled and return true to support dragging and override the isItemViewSwipeEnabled to support swiping.