Created
February 20, 2015 15:40
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void drawDirectionToMap(List<LatLng> latLngList) { | |
PolylineOptions line = new PolylineOptions().width(3).color(Color.BLUE); | |
for (int i = 0; i < latLngList.size(); i++) { | |
line.add(latLngList.get(i)); | |
} | |
mMap.addPolyline(line); | |
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(latLngList.get(0).latitude, latLngList.get(0).longitude), 14)); | |
// add marker diawal | |
mMap.addMarker(new MarkerOptions() | |
.position(new LatLng(latLngList.get(0).latitude, latLngList.get(0).longitude)) | |
.title("starting point") | |
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker)) | |
); | |
// add marker di akhir | |
int index = latLngList.size() - 1; | |
mMap.addMarker(new MarkerOptions() | |
.position(new LatLng(latLngList.get(index).latitude, latLngList.get(index).longitude)) | |
.title("end point") | |
.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_marker)) | |
); | |
Toast.makeText(this, "Jalur berhasil digambar kak, hati2 dijalan pelan2 saja,,, ", Toast.LENGTH_SHORT).show(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment