I want to custom the UI of exoplayer using these codes
<com.google.android.exoplayer2.ui.PlayerView
android:id="@+id/exoplayer"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:controller_layout_id="@layout/control_view_normal"/>
This is control_view_normal,corresponding to the app:controller_layout_id
Then I try to find the exo_fullscreen_button in the code
View controlView = videoView.findViewById(R.id.exo_controller);
controlView.findViewById(R.id.exo_fullscreen_button)
.setOnClickListener(v -> { //null pointer exception! why?
((Activity)context).setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
});
Moreover,the compiler gives me a controlView.findViewById(R.id.exo_fullscreen_button)
is null pointer.
Someone know how should I find the custom button in the custom layout?