@Override
  public void onResume() {
    super.onResume();
    if (!idPoi.equals("")) {
      // get info of the event
      POIObject poi = DTHelper.findPOIById(idPoi);

      if (poi == null) {
        // cancellazione
        removePoi(indexAdapter);

      } else {
        // modifica se numero della versione e' diverso
        if (poi.getUpdateTime() != getPoiAdapter().getItem(indexAdapter).getUpdateTime()) {
          removePoi(indexAdapter);
          insertPOI(poi);
        }
      }
      // notify
      getPoiAdapter().notifyDataSetChanged();
      updateList(getAdapter().getCount() == 0);
      idPoi = "";
      indexAdapter = 0;
    }
  }
 @Override
 public List<SemanticSuggestion> getTags(CharSequence text) {
   try {
     return DTHelper.getSuggestions(text);
   } catch (Exception e) {
     return Collections.emptyList();
   }
 }
 @Override
 public Boolean performAction(POIObject... params) throws SecurityException, Exception {
   object = params[0];
   return DTHelper.deletePOI(params[0]);
 }
  private List<POIObject> getPOIs(AbstractLstingFragment.ListingRequest... params) {
    try {
      Collection<PoiObjectForBean> result = null;
      List<POIObject> returnArray = new ArrayList<POIObject>();
      Bundle bundle = getArguments();
      boolean my = false;
      if (bundle.getBoolean(SearchFragment.ARG_MY)) my = true;
      String categories = bundle.getString(SearchFragment.ARG_CATEGORY);

      SortedMap<String, Integer> sort = new TreeMap<String, Integer>();
      sort.put("title", 1);
      if (bundle.containsKey(SearchFragment.ARG_CATEGORY)
          && (bundle.getString(SearchFragment.ARG_CATEGORY) != null)) {

        result =
            DTHelper.searchInGeneral(
                params[0].position,
                params[0].size,
                bundle.getString(SearchFragment.ARG_QUERY),
                (WhereForSearch) bundle.getParcelable(SearchFragment.ARG_WHERE_SEARCH),
                (WhenForSearch) bundle.getParcelable(SearchFragment.ARG_WHEN_SEARCH),
                my,
                PoiObjectForBean.class,
                sort,
                categories);

      } else if (bundle.containsKey(SearchFragment.ARG_MY)
          && (bundle.getBoolean(SearchFragment.ARG_MY))) {

        result =
            DTHelper.searchInGeneral(
                params[0].position,
                params[0].size,
                bundle.getString(SearchFragment.ARG_QUERY),
                (WhereForSearch) bundle.getParcelable(SearchFragment.ARG_WHERE_SEARCH),
                (WhenForSearch) bundle.getParcelable(SearchFragment.ARG_WHEN_SEARCH),
                my,
                PoiObjectForBean.class,
                sort,
                categories);

      } else if (bundle.containsKey(SearchFragment.ARG_QUERY)) {

        result =
            DTHelper.searchInGeneral(
                params[0].position,
                params[0].size,
                bundle.getString(SearchFragment.ARG_QUERY),
                (WhereForSearch) bundle.getParcelable(SearchFragment.ARG_WHERE_SEARCH),
                (WhenForSearch) bundle.getParcelable(SearchFragment.ARG_WHEN_SEARCH),
                my,
                PoiObjectForBean.class,
                sort,
                categories);

      } else if (bundle.containsKey(SearchFragment.ARG_LIST)) {
        List<PoiObjectForBean> results =
            (List<PoiObjectForBean>) bundle.get(SearchFragment.ARG_LIST);
        for (PoiObjectForBean storyBean : results) {
          returnArray.add(storyBean.getObjectForBean());
        }
        return returnArray;
      } else {
        return Collections.emptyList();
      }

      for (PoiObjectForBean storyBean : result) {
        returnArray.add(storyBean.getObjectForBean());
      }
      return returnArray;

    } catch (Exception e) {
      Log.e(PoisListingFragment.class.getName(), e.getMessage());
      e.printStackTrace();
      return Collections.emptyList();
    }
  }
  protected void setupOptionsListeners(final ViewSwitcher vs, final int position) {
    final POIObject poi = ((PoiPlaceholder) vs.getTag()).poi;

    ImageButton b = (ImageButton) vs.findViewById(R.id.poi_delete_btn);
    // CAN DELETE ONLY OWN OBJECTS
    if (DTHelper.isOwnedObject(poi)) {
      b.setVisibility(View.VISIBLE);
      b.setOnClickListener(
          new OnClickListener() {
            @Override
            public void onClick(View v) {
              {
                new SCAsyncTask<POIObject, Void, Boolean>(
                        getActivity(), new POIDeleteProcessor(getActivity()))
                    .execute(poi);
              }
            }
          });
    } else {
      b.setVisibility(View.GONE);
    }

    b = (ImageButton) vs.findViewById(R.id.poi_edit_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            {
              FragmentTransaction fragmentTransaction =
                  getSherlockActivity().getSupportFragmentManager().beginTransaction();
              Fragment fragment = new CreatePoiFragment();
              setStorePoiId((View) vs, position);
              Bundle args = new Bundle();
              args.putSerializable(CreatePoiFragment.ARG_POI, poi);
              fragment.setArguments(args);
              fragmentTransaction.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
              // fragmentTransaction.detach(this);
              fragmentTransaction.replace(R.id.fragment_container, fragment, "pois");
              fragmentTransaction.addToBackStack(fragment.getTag());
              fragmentTransaction.commit();
            }
          }
        });
    b = (ImageButton) vs.findViewById(R.id.poi_tag_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            {
              TaggingDialog taggingDialog =
                  new TaggingDialog(
                      getActivity(),
                      new TaggingDialog.OnTagsSelectedListener() {

                        @SuppressWarnings("unchecked")
                        @Override
                        public void onTagsSelected(Collection<SemanticSuggestion> suggestions) {
                          new TaggingAsyncTask(poi).execute(Utils.conceptConvertSS(suggestions));
                        }
                      },
                      PoisListingFragment.this,
                      Utils.conceptConvertToSS(poi.getCommunityData().getTags()));
              taggingDialog.show();
            }
          }
        });
    b = (ImageButton) vs.findViewById(R.id.poi_follow_btn);
    b.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            SCAsyncTask<Object, Void, BaseDTObject> followTask =
                new SCAsyncTask<Object, Void, BaseDTObject>(
                    getSherlockActivity(),
                    new FollowAsyncTaskProcessor(getSherlockActivity(), null));
            followTask.execute(
                getSherlockActivity().getApplicationContext(),
                DTParamsHelper.getAppToken(),
                DTHelper.getAuthToken(),
                poi);
          }
        });
  }