I created this function to make the button do a sound when i click it, the sound file is mp3 located in raw/button_click.mp3
directory .
fun play_sound(which_one:Int) {
if(which_one == 1){
val mediaPlayer:MediaPlayer? = MediaPlayer.create(Context,R.raw.button_click)
mediaPlayer?.start()
}
}
But i get the following error when i run it Unresolved reference: Context
How should I edit my code to solve this problem?
By the way just ignore the if statement for now it always turns true for this stage of development.