Hi everyone, I want to ask what is the difference if I write something before super.onDestroyView (); and after super.onDestroyView (); see example below
Delete fragment before super.ondestoryview ();
@Override public void onDestroyView() { try { Fragment fragment = (getFragmentManager() .findFragmentById(R.id.mapviews)); FragmentTransaction ft = getActivity().getSupportFragmentManager() .beginTransaction(); ft.remove(fragment); ft.commit(); } catch (Exception e) { e.printStackTrace(); } super.onDestroyView(); }
Delete fragment after super.ondestoryview ();
@Override public void onDestroyView() { super.onDestroyView(); try { Fragment fragment = (getFragmentManager() .findFragmentById(R.id.mapviews)); FragmentTransaction ft = getActivity().getSupportFragmentManager() .beginTransaction(); ft.remove(fragment); ft.commit(); } catch (Exception e) { e.printStackTrace(); } }
source share