MediaPlayer in ViewPager don't change song correctly
I have a ViewPager that should do is start the song automatically and change the song for each element of the ViewPager. What happens is that when starting the activity the first song starts correctly but scrolling the ViewPager does not stop the song and changes to the new one.
This is my code:
Adapter:
class MyAdapter(var context: Context, private var myList: List) : PagerAdapter() {
private var mediaPlayer: MediaPlayer? = MediaPlayer()
override fun getCount(): Int {...