views:

174

answers:

2

Hi All

I have been trying to get this seemingly simple problem fixed for about half a day now. I have a working MapView and I just want to show the default zoom keys and have them there all the time. They do not appear at all - it's not that they appear then go away.

Code:

public void onCreate( Bundle savedInstanceState ) 
{
    super.onCreate( savedInstanceState );

    setContentView( R.layout.main );

    _altDisplay = (TextView) findViewById( R.id.altitudeDisplay );
    _speedDisplay = (TextView) findViewById( R.id.speedDisplay );
    _accuracyDisplay = (TextView) findViewById( R.id.accuracyDisplay );

    _mapView = (MapView) findViewById( R.id.mapView );
    _mapView.setBuiltInZoomControls(true);

    _mapController = _mapView.getController();
    _mapController.setZoom(22);

    _locationUpdates = new LocationUpdateHandler( (LocationManager) getSystemService( Context.LOCATION_SERVICE) );
    _locationUpdates.addObserver( this );
}

public void updateLocation( GeoPoint point, double altitude, float speed, float accuracy )
{
    _mapController.setCenter(point);

    _altDisplay.setText( "Altitude: " + Double.toString(altitude) );
    _speedDisplay.setText( "Speed: " + Float.toString(speed) );
    _accuracyDisplay.setText( "Accuracy: " + Float.toString(accuracy) );
}

I have tried commenting out the setZoom and tried moving the setBuiltInZoom controls to the updateLocation method. I've found a lot of posts in relation to this problem but none that solve it.

Thanks for your help.

+1  A: 

The zoom controls will only appear when the user taps on the appropriate area of the screen. I am not aware of a way to force them to appear, let alone stay permanently on the screen.

CommonsWare
A: 

As was said by commonsware, you cannot force the controls to appear.

But you may draw your own controls and set the scale of the map using the setZoom method of MapController.

dystroy