public static void addMapTypeMenu(IGxMapView mapView, Menu menu) { SubMenu subMenu = menu.addSubMenu(Menu.NONE, R.id.map_mode, 0, R.string.GXM_SelectMapType); MenuItem itemStandard = addMapTypeMenuOption( mapView, subMenu, GxMapViewDefinition.MAP_TYPE_STANDARD, MENU_TYPE_STANDARD, R.string.GXM_Standard); MenuItem itemSatellite = addMapTypeMenuOption( mapView, subMenu, GxMapViewDefinition.MAP_TYPE_SATELLITE, MENU_TYPE_SATELLITE, R.string.GXM_Satellite); MenuItem itemHybrid = addMapTypeMenuOption( mapView, subMenu, GxMapViewDefinition.MAP_TYPE_HYBRID, MENU_TYPE_HYBRID, R.string.GXM_Hybrid); subMenu.setGroupCheckable(GROUP_MAP_TYPE, true, true); String currentMapType = mapView.getMapType(); if (currentMapType.equalsIgnoreCase(GxMapViewDefinition.MAP_TYPE_SATELLITE)) itemSatellite.setChecked(true); else if (currentMapType.equalsIgnoreCase(GxMapViewDefinition.MAP_TYPE_HYBRID)) itemHybrid.setChecked(true); else itemStandard.setChecked(true); }
@Override public boolean onMenuItemClick(MenuItem item) { mMapView.setMapType(mType); mItem.setChecked(true); return true; }