Пример #1
0
  @Override
  protected void onDestroy() {
    if (Utils.isTaskRunning(mCityTask)) {
      mCityTask.cancel(true);
    }

    super.onDestroy();
  }
Пример #2
0
  private void searchCity() {
    final String city = mEditCityName.getText().toString().trim();
    if (!TextUtils.isEmpty(city) && !Utils.isTaskRunning(mCityTask)) {

      mButtonSearch.setClickable(false);
      mEditCityName.setEnabled(false);
      mSearching.setVisibility(View.VISIBLE);
      mListView.setVisibility(View.INVISIBLE);
      mImm.hideSoftInputFromWindow(mEditCityName.getWindowToken(), 0);
      mCityTask = new CityTask();
      mCityTask.execute(city);
    }
  }