Kotlin VideoView path with a changing resource name
I have a group of mp4 files (v1.mp4, v2mp4,...) inside the raw folder.
I need to read them randomly after a button is clicked.
I get the message "not possible to play this video".
If I point to a specific file in the setVideoPath, ("android.resource://" + packageName + "/" + R.raw.v2) the video is played, but do not change when the button is hit.
My code is the following:
fun onClick(view: View) {
// Change the word randomly
randOne = ThreadLocalRandom.current().nextInt(1,...