Skip to content

Retained Fragment

Leonardo Miceli edited this page Jun 1, 2016 · 5 revisions

Retained Fragments are kept on rotation while the activity, fragment manager and views are destroyed. onCreate is not called, but onCreateView does.

Useful to avoid loading expensive data and to allow uninterrumpted execution (sound)

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setRetainInstance(true);
        mBeatBox = new BeatBox(getActivity());
    }

Wiki map

###Network

Clone this wiki locally