private void updateMapBar(Document doc) { TextView distancetv = (TextView) findViewById(R.id.tv_station_info_distance); TextView durationtv = (TextView) findViewById(R.id.tv_station_info_duration); TextView stationNametv = (TextView) findViewById(R.id.tv_station_info_name); distancetv.setText(md.getDistanceText(doc)); durationtv.setText(md.getDurationText(doc)); stationNametv.setText(station_name); }
private void drawPolyline(Document doc) { ArrayList<LatLng> directionPoint = md.getDirection(doc); PolylineOptions rectLine = new PolylineOptions().width(20).color(Color.RED); for (int i = 0; i < directionPoint.size(); i++) { rectLine.add(directionPoint.get(i)); } googleMap.addPolyline(rectLine); }
private void drawDirections() { googleMap.clear(); if (current_location == null || !httpRequested) return; LatLng fromPosition = new LatLng(current_location.getLatitude(), current_location.getLongitude()); drawCurrentLocation(fromPosition); LatLng toPosition = new LatLng(to_latitude, to_longitude); googleMap.addMarker( markerOptions .position(toPosition) .title(station_name) .snippet(trainsAtStation) .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))); Document doc = md.getDocument(fromPosition, toPosition, GoogleDirection.MODE_WALKING); drawPolyline(doc); updateMapBar(doc); progressValue = 100; }