I have an xml file with videoview:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/back"
android:orientation="vertical"
android:screenOrientation="landscape">
<VideoView
android:id="@+id/videoview_concept"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
And My java part is:
public class playvideos extends Activity implements OnCompletionListener{
public Integer index_val=0;
@Override
public void onCompletion(MediaPlayer mediaPlayer) {
index_val++;
VideoView videoview= (VideoView)findViewById(R.id.videoview_concept);
checkdbconn();
videoview.setVideoURI(Uri.parse(prepare.txtLectureFileName[index_val]));
videoview.setMediaController(new MediaController(this));
videoview.requestFocus();
videoview.start();
}
public void playvideo(View view){
setContentView(R.layout.playvid);
VideoView videoview= (VideoView)findViewById(R.id.videoview_concept);
Log.i("Video URL",videourl_array[index_val]);
checkdbconn();
videoview.setVideoURI(Uri.parse(videourl_array[index_val]));
videoview.setMediaController(new MediaController(this));
videoview.requestFocus();
checkdbconn();
videoview.start();
}
The above code is a button click event. It works really well. If one first video finished, it should automatically play the second video. Thus I want to play all the videos in that array continuously. How to achieve this? Please help me out:)