setStreetView() and setTrafficView() is not working
im working on map view and i have set four views normal , Satellite ,Traffic and Street normal and satellite is working fine but when i click on street and traffic its not get associated views here is code.can any one kindly tell me how to post code after once as im unable to share my xml in this question it my first question so please help .
private MapView mapView;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.mapview开发者_如何学Python);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setClickable(true);
Drawable marker=getResources().getDrawable(R.drawable.icon);
marker.setBounds(0, 0, marker.getIntrinsicWidth(),
marker.getIntrinsicHeight());
InterestingLocations funPlaces = new InterestingLocations(marker);
mapView.getOverlays().add(funPlaces);
GeoPoint pt = funPlaces.getCenter(); // get the first-ranked point
mapView.getController().setCenter(pt);
mapView.getController().setZoom(15); // cheating. We could iterate
// and figure out a proper zoom.
}
@Override
protected boolean isLocationDisplayed() {
return false;
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
public void myClickHandler(View target) {
switch(target.getId()) {
case R.id.sat:
mapView.setSatellite(true);
break;
case R.id.street:
mapView.setStreetView(true);
break;
case R.id.traffic:
mapView.setTraffic(true);
break;
case R.id.normal:
mapView.setSatellite(false);
mapView.setStreetView(false);
mapView.setTraffic(false);
break;
}
}
Take a look at the solution I posted yesterday on a similar question, which is working. The implementation remembers which mode you're in as well:
Is there a method to check whether the current Map is in Map or Satellite mode?
Hopefully this will help you in resolving your issue.
精彩评论