Search code examples
kotlinandroid-recyclerviewandroid-toast

How to show "Toast" after scrolling down a certain amount in Kotlin


I want to implement a feature in my app where it shows a Toast/message when a user scrolls down the recyclerview. For example when the user is scrolling down the screen, after they pass about 10 items a Toast pops up saying "Tap the home button to go back to the top"

How would I go about doing this?


Solution

  • I don't know if this would work, but you can try doing it in your adapter. like

    when (position) {
          10 -> Toast.makeText().show
    }
    

    or use an if statment. Again, I don't know for sure if it would work, but I think so.