@Override protected void onDestroy() { if (Utils.isTaskRunning(mCityTask)) { mCityTask.cancel(true); } super.onDestroy(); }
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); } }