コード例 #1
0
  @Override
  public void onDetach() {
    super.onDetach();
    if (task != null) task.cancel(true);

    if (removeTask != null) removeTask.cancel(true);
  }
コード例 #2
0
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   adapter = new FilterAdapter(getActivity(), getListView(), list);
   setListAdapter(adapter);
   setEmptyText(getString(R.string.filter_is_empty));
   if (task == null || task.getStatus() == MyAsyncTask.Status.FINISHED) {
     task = new DBTask();
     task.executeOnExecutor(MyAsyncTask.THREAD_POOL_EXECUTOR);
   }
   getListView().setChoiceMode(AbsListView.CHOICE_MODE_MULTIPLE_MODAL);
   getListView().setMultiChoiceModeListener(new FilterMultiChoiceModeListener());
   getListView()
       .setOnItemClickListener(
           new AdapterView.OnItemClickListener() {
             @Override
             public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
               ModifyFilterDialog dialog = new ModifyFilterDialog(list.get(position));
               dialog.setTargetFragment(AbstractFilterFragment.this, 1);
               dialog.show(getFragmentManager(), "");
             }
           });
 }