How to draw a route between two geopoints on the Android

I have two OverlayItem's on a MapView. How can I draw a route between the two geopoints?

Asked by: Emma912 | Posted: 20-01-2022

Answer 1

This application is contained with source code... It'll solve ur probs.

Answered by: Max840 | Posted: 21-02-2022

Answer 2

This posting J2ME/Android/BlackBerry - driving directions, route between two locations suggests:

you must not use the Map Service with any applications for route guidance, including but not limited to turn-by-turn route guidance that is synchronized to the position of a user's sensor-enabled device

As such, there is no Android or Google API for showing the route between two points on Android, as far as I know. People have hacked it in by various approaches, but you run the risk of having your Map key disabled.

If I am wrong, I would love to be corrected.

Answered by: Brianna352 | Posted: 21-02-2022

Similar questions

android - I want to generate geopoints after parsing XML using SAX Parser

I am able to parse XML using SAX Parser and able to display the points in text view. But now I want the points to be displayed on the map.The XML Contains tags for latitude and longitude. I want to read the latitiudes and longitudes and display them on map. UPDATE: public void parsing() { try { SAXParserFactory spf = SAXParserFactory.newInstance(); SAXParser sp = s...

Drawing a line between 2 geopoints using Android 2.3

i am trying to draw a line between 2 geopoints. i am able to show to geopoints on the map. Its working fine. but i am not able to draw a line between 2 points. program has no error but line is not getting displayed. can anyone tell me what i have to change. public class HelloMapView extends MapActivity { /** Called when the activity is first created. */ LinearLayout linearLayout; MapView mapView; MapCont...

Line between Two GeoPoints in Google map in android?

Hi I want to draw a line between 2 GeoPoints on Google map in android.Your help will be deeply appreciated.

android - how to find the distance between two geopoints?

double distance; Location locationA = new Location("point A"); locationA.setLatitude(latA); locationA.setLongitude(lngA); Location locationB = new Location("point B"); locationB.setLatitude(latB); LocationB.setLongitude(lngB); distance = locationA.distanceTo(locationB); the above code is not working and i am getting 0.0 Km as distance? Also in the constructor of the location ...

android - GeoPoints from existing SQLite Database

I am trying to populate a map overlay with markers using lat and long from an existing SQLite database. I have found examples where you input the lat and long as part of the method but none where it is populated from the database itself. I presume you use a Cursor to do this but I am not sure how to do it. I have used Cursors to populate ListViews but can not seem to modify the code for the map overlay. Can anyone...

android - Get Geopoints from SQlite DB

I created an SQlite database to store on it all latitudes and longitudes to display them in map. For the add of the values i didn't encouter any problem, i used this code: CoordBD CoordBd = new CoordBD(this); Coordo coordo = new Coordo(36.869686,10.315642 );; CoordBd.insertCoordo(coordo); But i don't know how to insert them one by one in map, i usually/manually make this:

android - How to zoom a MapView so it always includes two geopoints?

I have two geo points that vary intermittently, and want the MapView to resize and translate to make sure both points are always visible. I can easily re-centre the map on the point mid-way between the two, but how do I set the zoom level to ensure my two points are visible?

android - Loading GeoPoints / Path on MapView is taking forever. Any way to speed it up?

I am working with a custom MapView for an application. I have a database with a LOT of GPS datapoints saved and I am currently loading them using Overlays, then performing an .addAll on the MapView with the Overlays. However, it is taking up to 2 minutes to load just a few hundred data points as a path on the MapView. The code to load the Data Points is: private void loadMap() { ...

android - Distance between geopoints

I have a problem calculating the distance between two geopoints. The geopoints are: position1 = mapView.getProjection().fromPixels( (int) e.getX(), (int) e.getY()); and the other one double lat = 35.1064; double lng = 22.556412; GeoPoint position2 = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6)); Then I create two locations: Loca...

google maps - Not able to draw path between two geopoints in android mapview?

I am following the Developer Guide Hello Views example to develope a MapView and draw path between those two geopoints. I got the two geopoints but I can't draw the path between them. To solve this I followed the stackoverflow question with 36 upvoted answer by modifying a little. But still I am unable to resolve the problem. My co...

Still can't find your answer? Check out these communities...

Android Google Support | Android Community | Android Community (Facebook) | Android