コード例 #1
0
  private boolean onItemLongClick(int pos) {
    final HistoryEntry entry = ((HistoryAdapter) getListAdapter()).getItem(pos);
    AlertDialog.Builder builder = new AlertDialog.Builder(SearchHistoryActivity.this);
    builder.setTitle(entry.getName());
    builder.setItems(
        new String[] {getString(R.string.show_poi_on_map), getString(R.string.navigate_to)},
        new DialogInterface.OnClickListener() {

          @Override
          public void onClick(DialogInterface dialog, int which) {
            if (which == 0) {
              OsmandSettings settings =
                  OsmandSettings.getOsmandSettings(SearchHistoryActivity.this);
              settings.setMapLocationToShow(
                  entry.getLat(),
                  entry.getLon(),
                  settings.getLastKnownMapZoom(),
                  null,
                  entry.getName());
            } else if (which == 1) {
              OsmandSettings.getOsmandSettings(SearchHistoryActivity.this)
                  .setPointToNavigate(entry.getLat(), entry.getLon(), null);
            }
            MapActivity.launchMapActivityMoveToTop(SearchHistoryActivity.this);
          }
        });
    builder.show();
    return true;
  }
コード例 #2
0
 private void selectModel(HistoryEntry model) {
   helper.selectEntry(model, this);
   OsmandSettings settings = OsmandSettings.getOsmandSettings(SearchHistoryActivity.this);
   settings.setMapLocationToShow(
       model.getLat(), model.getLon(), settings.getLastKnownMapZoom(), null, model.getName());
   MapActivity.launchMapActivityMoveToTop(this);
 }