How to automatically play the song after it ends in Kotlin?

Issue So I have my code like this var flag = 0 player = MediaPlayer.create(this,songResources.getValue(songList[flag]).rawId) player.start() player.setOnCompletionListener { flag++ player = MediaPlayer.create(this,songResources.getValue(songList[flag]).rawId) player.start() player.setOnCompletionListener { flag++ player=MediaPlayer.create(this,songResources.getValue(songList[flag]).rawId) player.start() player.setOnCompletionListener { //and so on, and so forth. //assume this is the

Continue reading