简体   繁体   中英

Sample code to Draw routes Using Google Maps on Android

I want to draw a path between given start and end directions for my custom Map application.

Is there any library to draw routes (driving path) for Android native app.

Thanks.

try this

String uri = "http://maps.google.com/maps?f=d&hl=en&saddr="+latitude+","+longitude+"&daddr="+location.getLatitude()+","+location.getLongitude();
            Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
            intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity");
            startActivity(intent);

If you want to draw path in native app then this intent will help you

Intent intent = new Intent(android.content.Intent.ACTION_VIEW,Uri.parse("http://maps.google.com/maps?saddr="+ String.valueOf(current_lattitude) +","+ String.valueOf(current_longitude) +"&daddr="+ String.valueOf(dest_lati) +","+ String.valueOf(dest_longi)));
                        startActivity(intent);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM