Как нарисовать направление маршрута из текущего местоположения в пункт назначения, который (широта и долгота), у меня есть код, как показано ниже:
import android.os.Bundle;
import com.actionbarsherlock.app.SherlockActivity;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.MapFragment;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.MarkerOptions;
public class DetailMapActivity extends SherlockActivity {
private GoogleMap map;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main_detail_map);
LatLng TO_DESTINATION = new LatLng(-6.33438, 106.74316);
map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
.getMap();
map.setMyLocationEnabled(true);
map.addMarker(new MarkerOptions().position(TO_DESTINATION).title("Destination Title")
.snippet("Destination Description"));
map.moveCamera(CameraUpdateFactory.newLatLngZoom(TO_LOCATION, 40));
map.animateCamera(CameraUpdateFactory.zoomTo(10), 2000, null);
}
}
Я хочу извлечь из текущего местоположения сеть провайдера или gps, а затем нарисовать маршрут, направляясь к месту назначения.
Я использую android google apis V2.
Спасибо за вашу помощь.