I am trying to play an audio file based on a user selection... if the user choose from spinner the second value so the file will be 02.mp3 and if the selection is 153 the file will be 153.mp3
the line of code with the problem is:
mediaPlayer.setDataSource(getApplicationContext(), Uri.parse("android.resource://" + getPackageName() + "/raw/" + dir));
dir = the user selection from the spinner as string, Ex: "023.mp3"
the mp3 files are in the raw folder of the app
the result of the line of code is: android.resource://mypackagename/raw/023.mp3
but the mp3 file not playing...
image link for the error: https://ibb.co/eJS7dv Please help
thank in advance