0
0
Android Kotlinmobile~5 mins

Swipe to dismiss in Android Kotlin - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is "Swipe to dismiss" in Android apps?
It is a user interaction where you swipe a list item sideways to remove it from the screen, like swiping away a notification.
Click to reveal answer
beginner
Which Android component helps detect swipe gestures for dismissing items?
ItemTouchHelper is a utility class that simplifies adding swipe and drag & drop support to RecyclerView items.
Click to reveal answer
intermediate
What method do you override to handle swipe dismiss in ItemTouchHelper.Callback?
You override onSwiped(viewHolder: RecyclerView.ViewHolder, direction: Int) to react when an item is swiped.
Click to reveal answer
intermediate
How do you update the UI after an item is swiped away?
Remove the item from your data list and notify the adapter with notifyItemRemoved(position) to update the RecyclerView.
Click to reveal answer
beginner
Why is it important to provide an undo option after swipe to dismiss?
Because users might swipe accidentally, an undo option improves user experience by allowing recovery of dismissed items.
Click to reveal answer
Which class helps add swipe to dismiss functionality to RecyclerView items?
AItemTouchHelper
BGestureDetector
CSwipeRefreshLayout
DViewPager2
What method is called when a RecyclerView item is swiped?
AonItemClick()
BonDrag()
ConScroll()
DonSwiped()
After removing an item from the data list, which adapter method updates the UI?
AnotifyItemInserted()
BnotifyItemRemoved()
CnotifyDataSetChanged()
DnotifyItemChanged()
Why should you avoid removing the item from the data list before swipe animation completes?
AIt prevents swipe animation from showing
BIt causes app crashes
CIt slows down the app
DIt disables scrolling
What is a good UX practice after swipe to dismiss?
AImmediately close the app
BShow a confirmation dialog
CProvide an undo option
DDisable further swipes
Explain how to implement swipe to dismiss in a RecyclerView using Kotlin.
Think about how to detect swipe and update the list.
You got /4 concepts.
    Describe why providing an undo option after swipe to dismiss is important for user experience.
    Consider what happens if a user makes a mistake.
    You got /4 concepts.