I am developing an app related to Android Place Locator, I have worked to show the locations (Many locations and own location) but I want to show the path between any two locations. Location may be any two. Worked a lot but didn't find any solution. Please provide me some reference so that I can get the solution.
            Asked
            
        
        
            Active
            
        
            Viewed 626 times
        
    0
            
            
        - 
                    Refer http://stackoverflow.com/questions/2176397/drawing-a-line-path-on-google-maps – Jan 02 '13 at 09:47
2 Answers
0
            
            
        try this code   
   String uri = "http://maps.google.com/maps?saddr=" +
   currentLatitude+","+currentLongitude+"&daddr="+fixedLatitude+","+fixedLongitude;
   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);
May this help you
 
    
    
        Pankaj Singh
        
- 2,241
- 2
- 16
- 16
0
            
            
        To add this library add dependency in gradle as
compile 'com.akexorcist:googledirectionlibrary:1.0.4'
use this code in activity
GoogleDirection.withServerKey("YOUR_SERVER_API_KEY")
            .from(new LatLng(37.7681994, -122.444538))
                .to(new LatLng(37.7749003,-122.4034934))
                .avoid(AvoidType.FERRIES)
                .avoid(AvoidType.HIGHWAYS)
                .execute(new DirectionCallback() {
        @Override
        public void onDirectionSuccess(Direction direction, String rawBody) {
            if(direction.isOK()) {
                // Do something
Snackbar.make(btnRequestDirection, "Success with status : " + direction.getStatus(), Snackbar.LENGTH_SHORT).show();
              googleMap.addMarker(new MarkerOptions().position(origin));
            googleMap.addMarker(new MarkerOptions().position(destination));
            ArrayList<LatLng> directionPositionList = direction.getRouteList().get(0).getLegList().get(0).getDirectionPoint();
            googleMap.addPolyline(DirectionConverter.createPolyline(this, directionPositionList, 5, Color.RED));
        }
            } else {
                // Do something
            }
        }
        @Override
        public void onDirectionFailure(Throwable t) {
            // Do something
        }
    });
it would help you you ,its help me
 
    
    
        Mayank Garg
        
- 1,284
- 1
- 11
- 23
 
    