我正在使用google map app。当我定义一条路线(例如,从一号城市到二号城市)时,那么我如何获得一号城市和二号城市之间所有地点的纬度和经度。
destinationid= (EditText) findViewById(R.id.destinationid);
String clocation = destinationid.getText().toString();
List<Address> addressList=null;
if(clocation!= null || clocation!="")
{
Geocoder geocoder=new Geocoder(this);
try {
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse("google.navigation:q="+clocation+""));
startActivity(intent);
addressList= geocoder.getFromLocationName(clocation,1);
}
catch (IOException e)
{
e.printStackTrace();
}
Address address= addressList.get(0);
LatLng latLng=new LatLng(address.getLatitude(),address.getLongitude());
mMap.addMarker(new MarkerOptions().position(latLng).title("Current Location "));
mMap.animateCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.addMarker(new MarkerOptions().position(latLng).title("Current Location "));
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, 15.0f));
mMap.animateCamera(CameraUpdateFactory.zoomIn()); mMap.animateCamera(CameraUpdateFactory.zoomTo(15), 2000, null); CameraPosition cameraPosition = new CameraPosition.Builder()
.target(latLng)
.zoom(15)
.bearing(150)
.tilt(70)
.build();
mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
mMap.setTrafficEnabled(true);
}'