@Override
 protected void onResume() {
   if (mLoadPlaceTask != null) {
     mLoadPlaceTask.setListener(PlaceListActivity.this);
   }
   super.onResume();
 }
 @Override
 protected void onDestroy() {
   if (mLoadPlaceTask != null) {
     mLoadPlaceTask.setListener(null);
   }
   super.onDestroy();
 }
  @SuppressWarnings("deprecation")
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setAppName("survey");
    setContentView(R.layout.place_name_dialog);

    mLoadButtonContainer = (RelativeLayout) findViewById(R.id.loadButtonContainer);
    mLoadImageButton = (ImageButton) findViewById(R.id.loadImageButton);

    mPurgeButtonContainer = (RelativeLayout) findViewById(R.id.prugeButtonContainer);
    mPurgeImageButton = (ImageButton) findViewById(R.id.purgeImageButton);

    mLoadPlaceTask = (LoadPlaceTask) getLastNonConfigurationInstance();
    if (mLoadPlaceTask != null) {
      // setup dialog and upload task
      // showDialog(PROGRESS_DIALOG);

      // register this activity with the new loader task
      mLoadPlaceTask.setListener(PlaceListActivity.this);
    } else {
      mMessageTextView = (TextView) findViewById(R.id.messageTextView);

      File db_file =
          new File(
              ODKFileUtils.getPlaceNameDbFolder(getAppName())
                  + File.separator
                  + PlaceNameDatabaseHelper.PLACE_NAME_DATABASE_NAME);
      if (db_file.exists() == false) {
        File csv_file = new File(ODKFileUtils.getPlaceNameCsvFile(getAppName()));
        if (csv_file.exists() == false) {
          mMessageTextView.setText(
              getString(
                  R.string.unable_to_find_config_file,
                  ODKFileUtils.getPlaceNameDbFolder(getAppName())));

          disableButtons();
        }
      } else {
        // Count place name list loaded in the database and prepare the
        // message
        // to display accordingly.
        long count = PlaceNameUtil.getCount(this);
        if (count == 0) {
          mMessageTextView.setText(R.string.load_place_list);
        } else if (count == 1) {
          mMessageTextView.setText(R.string.one_place_list);
        } else {
          /*
           * int resourceId = this.getResources().getIdentifier(
           * "many_place_list", "string", this.getPackageName());
           */
          mMessageTextView.setText(getString(R.string.many_place_list, String.valueOf(count)));

          // + this.getString(resourceId));
        }
      }
    }
  }
  @SuppressWarnings("deprecation")
  public void loadClickListener(View v) {
    File csv_file = new File(ODKFileUtils.getPlaceNameCsvFile(getAppName()));
    if (csv_file.exists() == true) {
      disableButtons();

      showDialog(PROGRESS_DIALOG);

      mLoadPlaceTask = new LoadPlaceTask();
      mLoadPlaceTask.setApplication(getApplication());
      mLoadPlaceTask.setAppName(getAppName());
      mLoadPlaceTask.setListener(PlaceListActivity.this);
      mLoadPlaceTask.execute();
    } else {
      mMessageTextView.setText(
          getString(
              R.string.unable_to_find_config_file, ODKFileUtils.getPlaceNameCsvFile(getAppName())));
    }
  }