@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();
    }
  }
 @Override
 public void locationUpdate(LatLon l) {
   location = l;
   favouritesAdapter.sort(
       new Comparator<FavouritePoint>() {
         @Override
         public int compare(FavouritePoint object1, FavouritePoint object2) {
           if (location != null) {
             double d1 =
                 MapUtils.getDistance(location, object1.getLatitude(), object1.getLongitude());
             double d2 =
                 MapUtils.getDistance(location, object2.getLatitude(), object2.getLongitude());
             if (d1 == d2) {
               return 0;
             } else if (d1 > d2) {
               return 1;
             }
             return -1;
           } else {
             return favouritesAdapter
                 .getName(object1)
                 .compareTo(favouritesAdapter.getName(object2));
           }
         }
       });
 }
 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;
 }