diff --git a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java index e1232526d..9d8fd443f 100644 --- a/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java +++ b/app/src/main/java/org/schabi/newpipe/fragments/detail/VideoDetailFragment.java @@ -304,7 +304,8 @@ public final class VideoDetailFragment @Override public View onCreateView(@NonNull final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { - return inflater.inflate(R.layout.fragment_video_detail, container, false); + binding = FragmentVideoDetailBinding.inflate(inflater, container, false); + return binding.getRoot(); } @Override @@ -355,7 +356,6 @@ public final class VideoDetailFragment @Override public void onDestroy() { super.onDestroy(); - binding = null; // Stop the service when user leaves the app with double back press // if video player is selected. Otherwise unbind @@ -388,6 +388,12 @@ public final class VideoDetailFragment } } + @Override + public void onDestroyView() { + super.onDestroyView(); + binding = null; + } + @Override public void onActivityResult(final int requestCode, final int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); @@ -586,10 +592,9 @@ public final class VideoDetailFragment // Init //////////////////////////////////////////////////////////////////////////*/ - @Override + @Override // called from onViewCreated in {@link BaseFragment#onViewCreated} protected void initViews(final View rootView, final Bundle savedInstanceState) { super.initViews(rootView, savedInstanceState); - binding = FragmentVideoDetailBinding.bind(rootView); pageAdapter = new TabAdapter(getChildFragmentManager()); binding.viewPager.setAdapter(pageAdapter);