@Override
  protected void onResume() {
    super.onResume();
    waypoint = MyTracksProviderUtils.Factory.get(this).getWaypoint(markerId);
    if (waypoint == null) {
      Log.d(TAG, "waypoint is null");
      finish();
      return;
    }
    name.setText(getString(R.string.generic_name_line, waypoint.getName()));
    if (waypoint.getType() == WaypointType.WAYPOINT) {
      waypointSection.setVisibility(View.VISIBLE);
      statisticsSection.setVisibility(View.GONE);

      TextView markerType = (TextView) findViewById(R.id.marker_detail_waypoint_marker_type);
      markerType.setText(
          getString(R.string.marker_detail_waypoint_marker_type, waypoint.getCategory()));
      TextView description = (TextView) findViewById(R.id.marker_detail_waypoint_description);
      description.setText(getString(R.string.generic_description_line, waypoint.getDescription()));
    } else {
      waypointSection.setVisibility(View.GONE);
      statisticsSection.setVisibility(View.VISIBLE);
      StatsUtils.setTripStatisticsValues(this, waypoint.getTripStatistics());
      StatsUtils.setLocationValues(this, waypoint.getLocation(), false);
    }
  }
  @Override
  protected void onCreate(Bundle bundle) {
    super.onCreate(bundle);

    myTracksProviderUtils = MyTracksProviderUtils.Factory.get(this);
    markerId = getIntent().getLongExtra(EXTRA_MARKER_ID, -1L);
    if (markerId == -1L) {
      Log.d(TAG, "invalid marker id");
      finish();
      return;
    }
    name = (TextView) findViewById(R.id.marker_detail_name);
    waypointSection = findViewById(R.id.marker_detail_waypoint_section);
    statisticsSection = findViewById(R.id.marker_detail_statistics_section);
  }