@Override
  public void onDetach() {
    super.onDetach();
    if (task != null) task.cancel(true);

    if (removeTask != null) removeTask.cancel(true);
  }
 public void clear() {
   ArrayList<String> deletedList = new ArrayList<String>();
   deletedList.addAll(list);
   list.clear();
   adapter.notifyDataSetChanged();
   if (Utility.isTaskStopped(removeTask)) {
     removeTask = new RemoveFilterDBTask(deletedList);
     removeTask.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
   }
 }