I'm about to use 3 different videos with different buttons using only one VideoView
. What I want is when I clicked Button
1, video 1 will play on screen, and Button
2 video 2 will play. this will only happen in 1 VideoView
.
Is it possible? because I also try to array images using one ImageView
. I don't think on VideoView if will work.
can someone help me. code is much better thank you.
Asked
Active
Viewed 849 times
0

Maheshwar Ligade
- 6,709
- 4
- 42
- 59

Drenyl
- 906
- 1
- 18
- 41
-
Use both: http://stackoverflow.com/questions/9662390/how-to-stop-video-playing-in-videoview-programmatically-in-android, http://stackoverflow.com/questions/4229140/playing-multiple-videos-using-videoview – Androider Dec 13 '15 at 06:59
-
1@Androider thank you it really helps – Drenyl Jan 24 '16 at 08:25
1 Answers
0
yes i think it's possible
Onclick of 3 different buttons you should set different resources for VideoView
eg.
VideoView video = (VideoView)findViewById(R.id.video_view);
Button btn1,btn2,btn3,
btn1.setOnclick{
video.setVideoURI(uri[0]);
}
btn2.setOnclick{
video.setVideoURI(uri[1]);
}
btn3.setOnclick{
video.setVideoURI(uri[2]);
}

Prasad P
- 1,042
- 8
- 5