This is my code:
VideoView vd;
vd = (VideoView) findViewById(R.id.videoview2);
String path = "android.resource://" + getPackageName() + "/"
+ R.raw.video1;
vd.setVideoURI(Uri.parse(path));
vd.start();
This works, but i want the R.raw.video1 to be a string becaus i have a lot of videos to play.
So what i want is this:
String videoResource = "R.raw.video1"
String path = "android.resource://" + getPackageName() + "/"
+ videoResource;
Unfortunately this doesn’t work, how do i get it to work?
You need the identifier of the resource for that to work, which can be retrieved by its name using:
So your new code would become: