@Override
  public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    fileManager = FileManager.getSingleton(getContext());

    DeviceConnectionListener listener = null;
    Bundle args = getArguments();
    if (args != null) {
      fromDevice = args.getBoolean(ARG_FROM_DEVICE);
      if (fromDevice) {
        listener = this;
      }
    }
    usbConn = UsbConnection.getSingleton(getContext(), listener);

    mainHandler = new Handler(getContext().getMainLooper());
  }
 @Override
 public void onDestroy() {
   usbConn.removeListener(this);
   usbConn = null;
   super.onDestroy();
 }