有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

exoplayer中的java Recyclerview不起作用

我的应用程序在framelayout中使用exo player,并带有显示服务器列表的recyclerview,所以问题是,当我点击播放器上的任意位置时,通常会隐藏诸如play pause progressbar fullscrn等控件,但应用程序会崩溃,但如果我在点击播放器上的任意位置之前单击recyclerview,一切都会正常工作,就像recyclerview隐藏一样,就像exoplayer中的其他控件一样

simpleExoPlayerView.setControllerVisibilityListener(new PlayerControlView.VisibilityListener() {
        @Override
        public void onVisibilityChange(int visibility) {
            Log.e("Visibil", String.valueOf(visibility));
            if (visibility==0){
                rvServer.setVisibility(VISIBLE);
                imgBack.setVisibility(VISIBLE);
                imgFull.setVisibility(VISIBLE);
                if (listSub.size()!=0) {
                    imgSubtitle.setVisibility(VISIBLE);
                }
            }else {
                rvServer.setVisibility(GONE);
                imgBack.setVisibility(GONE);
                imgFull.setVisibility(GONE);
                imgSubtitle.setVisibility(GONE);
            }
        }
    });



<FrameLayout
        安卓:id="@+id/player_layout"
        安卓:layout_width="match_parent"
        安卓:layout_height="match_parent">
        <com.google.安卓.exoplayer2.ui.PlayerView
            安卓:id="@+id/video_view"
            安卓:layout_width="match_parent"
            安卓:layout_height="match_parent"
            app:controller_layout_id="@layout/custom_controls"
            />
        <LinearLayout
            安卓:orientation="vertical"
            安卓:layout_width="match_parent"
            安卓:layout_height="match_parent">
        <安卓x.recyclerview.widget.RecyclerView
            安卓:id="@+id/rv_server_list"
            安卓:layout_width="match_parent"
            安卓:nestedScrollingEnabled="false"
            安卓:layout_height="wrap_content">
        </安卓x.recyclerview.widget.RecyclerView>
        </LinearLayout>
        <com.google.安卓.exoplayer2.ui.SubtitleView
            安卓:id="@+id/subtitle"
            安卓:background="@color/transparent"
            安卓:layout_width="match_parent"
            安卓:layout_height="match_parent" />
        <ImageView
            安卓:id="@+id/img_subtitle"
            app:srcCompat="@drawable/ic_subtitle"
            安卓:layout_gravity="bottom|end"
            安卓:layout_marginBottom="42dp"
            安卓:layout_width="wrap_content"
            安卓:layout_height="wrap_content"
            安卓:layout_marginEnd="50dp" />
    </FrameLayout>

''错误日志

2019-09-09 09:37:26.318 21523-21523/com.demo.app E/vTYpe ::: 1
2019-09-09 09:37:30.392 21523-21523/com.demo.app E/STATE PLAYER:::: false
2019-09-09 09:37:44.515 21523-21523/com.demo.app E/Visibil: 8
2019-09-09 09:37:44.518 21523-21523/com.demo.app E/InputEventReceiver: Exception dispatching input event.
2019-09-09 09:37:44.518 21523-21523/com.demo.app E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
2019-09-09 09:37:44.521 21523-21523/com.demo.app E/MessageQueue-JNI: java.lang.NullPointerException: Attempt to invoke virtual method 'void 安卓.view.View.setVisibility(int)' on a null object reference
    at com.com.demo.app.DetailsActivity$11.onVisibilityChange(DetailsActivity.java:746)
    at com.google.安卓.exoplayer2.ui.PlayerControlView.hide(PlayerControlView.java:576)
    at com.google.安卓.exoplayer2.ui.PlayerView.onTouchEvent(PlayerView.java:798)
    at 安卓.view.View.dispatchTouchEvent(View.java:10024)

共 (0) 个答案