Saturday, 15 May 2010

android - How to draw path between two marker? -


I am using OSM in my Android application. And I have to show the path between the two markers. I have used the path overlay but do not draw the line.

Nobody knows how to draw the line between the two markers in the Android OSM map?

I found the solution - here is the answer:

  the new thread ( New Runnabal () {Public Zero Run} (Road Manager Road Manager = New OSRM Road Manager); Arest & Lieutenant; Geopoint & gt; Waypoints = New Array List & Lt; Geopoint & gt; (); Geopoint StartPoint = New Geopoint (source_lot, source_longgi); vepppoint.ed (start page); geopoint endpoint = new geopoint (Desti_lat, desti_longi); waypoints.add (Endpoint); Try {road = roadManager.getRoad (Waypoint);} Catch (Exception E) {e.printStackTrace ();} runOnUiThread (new Runnabel) {public void run () {if (road.mStatus! = Road.STATUS_OK) {// Handle error ... warns user, etc.} Polyline Road Overlay = Road Manager. Builder Overlay (road, color. Red, 8, context); map.getOverlays () (roadOverlay) .; }}); }     }).Start();  

And I'm using two JAR files: slf4j- android-1.5.8.jar and osmdroid-android-4.2.jar < / Code>, and osmbonuspack library.


No comments:

Post a Comment