@Override
  public void onResume() {
    Log.d(LOG_NAME, "onResume");
    super.onResume();

    theFinder.init();

    if (theAdapter == null) {
      theAdapter = new BookmarkAdapter(this);
      this.setListAdapter(theAdapter);
    }

    for (final BaseAgency anAgency : TheApp.theAgencies.values()) {
      anAgency.init(this);
    }

    theAdapter.clear();

    theDB = new BookmarksDataHelper(this);
    ArrayList<Bookmark> theBookmarks = theDB.getAllBookmarks();
    for (Bookmark aBookmark : theBookmarks) {
      theIntents.put(aBookmark, aBookmark.getTheIntent());
      theAdapter.add(aBookmark);
    }

    startLocationSearch();
    killRotateTimer();
    killRefreshPredictionTimer();

    setupRotateTimer();
    setupRefreshPredictionTimer();
  }
  @Override
  public void onPause() {
    super.onPause();
    if (theDB != null) {
      theDB.cleanUp();
      theDB = null;
    }
    if (theProgressDialog != null) {
      theProgressDialog.dismiss();
      theProgressDialog = null;
    }
    theFinder.finish();
    killPendingTasks();
    killRotateTimer();
    killRefreshPredictionTimer();
    getParent().setProgressBarIndeterminateVisibility(false);

    for (final BaseAgency ourAgency : TheApp.theAgencies.values()) {
      ourAgency.finish();
    }
  }