private void testSharedPrefsLocations() {
   SharedPreferences prefs = this.getSharedPreferences("distributed.directions.saved.locs", 0);
   SharedPreferences.Editor editor = prefs.edit();
   for (SavedLocation loc : SavedLocation.LOCS) {
     editor.putString(loc.getName(), loc.delimitedRep());
   }
   if (!editor.commit()) {
     Log.e("ERROR:  ", "Failed in testSharedPrefsLocations");
   }
 }
  public void onLocationChangeMade(SavedLocation newLoc, SavedLocation oldLoc) {
    testSharedPrefsLocations();
    logSharedPrefsLocations();
    SharedPreferences prefs = this.getSharedPreferences("distributed.directions.saved.locs", 0);
    if (prefs.contains(oldLoc.getName())) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.remove(oldLoc.getName());
      editor.putString(newLoc.getName(), newLoc.delimitedRep());
      boolean success = editor.commit();
      if (!success) {
        Log.e("ERROR:  ", "Failed to update shared preferences");
      }

    } else {
      Log.e("ERROR: ", "Shared Prefs did not have " + oldLoc.getName());
    }
    SavedLocationListFragment frag =
        (SavedLocationListFragment)
            getSupportFragmentManager().findFragmentById(R.id.savedlocation_list);
    frag.updateLocAdapter();
  }
  private void loadLocations() {
    SharedPreferences prefs = this.getSharedPreferences("distributed.directions.saved.locs", 0);
    Map<String, ?> locMap = prefs.getAll();
    Set<String> keys = locMap.keySet();
    String next;
    for (String s : keys) {
      next = prefs.getString(s, "");
      if (next.length() > 0) {

        SavedLocation.addLoc(new SavedLocation(next));
      }
    }
  }