@Override
 public void onDialogPositiveClick(City newCity, City oldCity) {
   if (oldCity != null) {
     cityAdapter.remove(oldCity);
   }
   cityAdapter.add(newCity);
 }
  @Override
  public boolean onContextItemSelected(MenuItem city) {
    int cityPosition = ((AdapterContextMenuInfo) city.getMenuInfo()).position;
    City selectedCity = cityAdapter.getItem(cityPosition);

    switch (city.getItemId()) {
      case R.id.menu_edit:
        return editCity(selectedCity);
      case R.id.menu_delete:
        cityAdapter.remove(selectedCity);
        return true;
      default:
        return super.onContextItemSelected(city);
    }
  }
 /* Serializing cities */
 @Override
 public void onStop() {
   cityAdapter.revertData();
   preferencesManager.saveListToFile(cityAdapter.getCities());
   super.onStop();
 }