@Override
  protected void onPause() {
    super.onPause();

    search.dismissDialogs();
    library.dismissDialogs();
    peers.dismissDialogs();
  }
  @Override
  protected void onPause() {
    super.onPause();

    if (mainBroadcastReceiver != null) {
      try {
        unregisterReceiver(mainBroadcastReceiver);
      } catch (Throwable t) {
        // oh well (the api doesn't provide a way to know if it's been registered before,
        // seems like overkill keeping track of these ourselves.)
      }
    }
  }