@Override
  protected void onListItemClick(ListView l, View v, int position, long id) {

    if (!isSelectFavoriteMode()) {
      QuickAction qa = new QuickAction(v);
      FavouritePoint point = favouritesAdapter.getItem(position);
      String name = getString(R.string.favorite) + ": " + point.getName();
      LatLon location = new LatLon(point.getLatitude(), point.getLongitude());
      View.OnClickListener onshow =
          new View.OnClickListener() {

            @Override
            public void onClick(View v) {
              settings.SHOW_FAVORITES.set(true);
            }
          };
      MapActivityActions.createDirectionsActions(
          qa, location, point, name, settings.getLastKnownMapZoom(), this, true, onshow);
      qa.show();
    } else {
      Intent intent = getIntent();
      intent.putExtra(SELECT_FAVORITE_POINT_INTENT_KEY, favouritesAdapter.getItem(position));
      setResult(SELECT_FAVORITE_POINT_RESULT_OK, intent);
      finish();
    }
  }
 private boolean onItemLongClick(int pos) {
   final FavouritePoint entry = favouritesAdapter.getItem(pos);
   AlertDialog.Builder builder = new AlertDialog.Builder(FavouritesListActivity.this);
   builder.setTitle(entry.getName());
   OnClickListener onClickListener =
       new DialogInterface.OnClickListener() {
         @Override
         public void onClick(DialogInterface dialog, int which) {
           if (which == 0) {
             settings.setMapLocationToShow(
                 entry.getLatitude(),
                 entry.getLongitude(),
                 settings.getLastKnownMapZoom(),
                 null,
                 getString(R.string.favorite) + ":\n " + entry.getName(),
                 entry); //$NON-NLS-1$
           } else if (which == 1) {
             settings.setPointToNavigate(
                 entry.getLatitude(),
                 entry.getLongitude(),
                 getString(R.string.favorite) + " : " + entry.getName());
           }
           MapActivity.launchMapActivityMoveToTop(FavouritesListActivity.this);
         }
       };
   builder.setItems(
       new String[] {getString(R.string.show_poi_on_map), getString(R.string.navigate_to)},
       onClickListener);
   builder.show();
   return true;
 }
    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
      View row = convertView;
      if (row == null) {
        LayoutInflater inflater = getLayoutInflater();
        row = inflater.inflate(R.layout.favourites_list_item, parent, false);
      }

      TextView label = (TextView) row.findViewById(R.id.favourite_label);
      TextView distanceLabel = (TextView) row.findViewById(R.id.favouritedistance_label);
      ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
      final FavouritePoint model = getItem(position);
      if (model.isStored()) {
        icon.setImageResource(R.drawable.favorites);
      } else {
        icon.setImageResource(R.drawable.opened_poi);
      }
      if (location != null) {
        int dist =
            (int)
                (MapUtils.getDistance(
                    model.getLatitude(),
                    model.getLongitude(),
                    location.getLatitude(),
                    location.getLongitude()));
        distanceLabel.setText(
            OsmAndFormatter.getFormattedDistance(dist, FavouritesListActivity.this));
        distanceLabel.setVisibility(View.VISIBLE);
      } else {
        distanceLabel.setVisibility(View.GONE);
      }

      label.setText(getName(model));
      final CheckBox ch = (CheckBox) row.findViewById(R.id.check_item);
      row.findViewById(R.id.favourite_icon).setVisibility(View.VISIBLE);
      ch.setVisibility(View.GONE);
      return row;
    }
 public String getName(FavouritePoint model) {
   return model.getCategory() + " : " + model.getName();
 }