无法使媒体控制器显示下一个/上一个按钮

时间:2018-09-11 00:34:30

标签: android-videoview mediacontroller

我希望媒体控制器在其上显示下一个和上一个按钮。需要帮助 好吧,我尝试过了,但是对我却不起作用。还有其他方法吗?

mediaController = new MediaController(VideoPlayer.this);
    mediaController.setPrevNextListeners(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //Handle next click here
            v.setVisibility(View.VISIBLE);
            listView1.setSelection(videoNumber+1);
            listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    System.gc();
                    video_column_index = videoCursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
                    videoCursor.moveToPosition(position);
                    filename = videoCursor.getString(video_column_index);
                    videoView1.setVideoPath(filename);
                    videoView1.start();
                }
            });
        }
    }, new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            //Handle previous click here
            v.setVisibility(View.VISIBLE);
            listView1.setSelection(videoNumber-1);
            listView1.setOnItemClickListener(new AdapterView.OnItemClickListener() {
                @Override
                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                    System.gc();
                    video_column_index = videoCursor.getColumnIndexOrThrow(MediaStore.Video.Media.DATA);
                    videoCursor.moveToPosition(position);
                    filename = videoCursor.getString(video_column_index);
                    videoView1.setVideoPath(filename);
                    videoView1.start();
                }
            });
        }
    });

0 个答案:

没有答案