@Override
 public void onPause() {
   super.onPause();
   savePreviouslyCheckedFileDescriptors();
   savePreviousFilter();
   getActivity().unregisterReceiver(broadcastReceiver);
 }
  @Override
  public void onResume() {
    super.onResume();
    initBroadcastReceiver();

    if (adapter != null) {
      restorePreviouslyChecked();
      restorePreviousFilter();
      browseFilesButtonClick(adapter.getFileType());
    }
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    setRetainInstance(true);
  }