Steve
Steve

Reputation: 71

How can I set this to toggle the map view?

i want to toggle the map view on my android map app - I have been told to use this code:

@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.mapview :
EVENT HERE TO TOGGLE MAP VIEW TO AND FROM SATELLITE 
default :
return super.onOptionsItemSelected(item);
}
}

However, I added this code to the end of my map page code -- but i don't know what to put in the middle to make this menu item actually toggle from the different maps available. Help???

Upvotes: 0

Views: 133

Answers (1)

MByD
MByD

Reputation: 137352

If I get you right, you should do something like that:

case R.id.mapview :
    myMapView.setSatellite(!myMapView.isSatellite());
    break;

Upvotes: 2

Related Questions