diff --git a/app/src/main/java/org/schabi/newpipe/BaseFragment.java b/app/src/main/java/org/schabi/newpipe/BaseFragment.java
index 19a99009bd8..be9d63cc870 100644
--- a/app/src/main/java/org/schabi/newpipe/BaseFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/BaseFragment.java
@@ -80,9 +80,23 @@ protected void onRestoreInstanceState(@NonNull final Bundle savedInstanceState)
// Init
//////////////////////////////////////////////////////////////////////////*/
+ /**
+ * This method is called in {@link #onViewCreated(View, Bundle)} to initialize the views.
+ *
+ * {@link #initListeners()} is called after this method to initialize the corresponding
+ * listeners.
+ * @param rootView
+ * @param savedInstanceState
+ */
protected void initViews(final View rootView, final Bundle savedInstanceState) {
}
+ /**
+ * Initialize the listeners for this fragment.
+ *
+ * This method is called after {@link #initViews(View, Bundle)}
+ * in {@link #onViewCreated(View, Bundle)}.
+ */
protected void initListeners() {
}
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java
index 85603d33705..a3d3d8b60f2 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/BaseStateFragment.java
@@ -80,6 +80,8 @@ public void onDestroyView() {
if (errorPanelHelper != null) {
errorPanelHelper.dispose();
}
+ emptyStateView = null;
+ emptyStateMessageView = null;
}
protected void onRetryButtonClicked() {
diff --git a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
index e1b61ea7c14..02364295500 100644
--- a/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
+++ b/app/src/main/java/org/schabi/newpipe/fragments/MainFragment.java
@@ -139,6 +139,12 @@ public void onDestroy() {
}
}
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ binding = null;
+ }
+
/*//////////////////////////////////////////////////////////////////////////
// Menu
//////////////////////////////////////////////////////////////////////////*/