// Testing methods to make sure that shared preferences is working
 private void testSharedPrefsDevices() {
   SharedPreferences prefs = this.getSharedPreferences("distributed.directions.saved.devices", 0);
   SharedPreferences.Editor editor = prefs.edit();
   for (AutomatedDevice dev : AutomatedDevice.DEVICE_LIST) {
     editor.putString(dev.getName(), dev.delimitedRep());
   }
   if (!editor.commit()) {
     Log.i("ERROR:  ", "Failed in testSharedPrefsDevices");
   }
 }
  // Listener interface method to make sure that changes made in the detail fragment get saved
  // appropriately and update the UI
  public void onDeviceChangeMade(AutomatedDevice newDev, AutomatedDevice oldDev) {
    testSharedPrefsDevices();
    logSharedPrefsDevices();
    SharedPreferences prefs = this.getSharedPreferences("distributed.directions.saved.devices", 0);
    if (prefs.contains(oldDev.getName())) {
      SharedPreferences.Editor editor = prefs.edit();
      editor.remove(oldDev.getName());
      editor.putString(newDev.getName(), newDev.delimitedRep());
      boolean success = editor.commit();
      if (!success) {
        Log.i("ERROR:  ", "Failed to update shared preferences");
      }

    } else {
      Log.i("ERROR: ", "Shared Prefs did not have " + oldDev.getName());
    }
    AutomatedDeviceListFragment frag =
        (AutomatedDeviceListFragment)
            getSupportFragmentManager().findFragmentById(R.id.automateddevice_list);
    frag.updateDevAdapter();
  }