@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case 102: mMap.setSatellite(!mMap.isSatellite()); break; // case 103: maMap.setTraffic(!maMap.isTraffic()) ;break; // case 104: maMap.setStreetView(!maMap.isStreetView()) ;break; case android.R.id.home: finish(); } return true; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.my_map); setResult(RESULT_OK); mMap = (MapView) findViewById(R.id.myGmap); mMap.setBuiltInZoomControls(true); mMap.setSatellite(false); mController = mMap.getController(); Bundle extras = getIntent().getExtras(); double glat = 0; double glon = 0; if (extras != null) { name = extras.getString("Name"); glat = extras.getDouble("lat"); glon = extras.getDouble("lon"); } else Toast.makeText(this, "Error while getting train position", Toast.LENGTH_LONG).show(); // Toast.makeText(this, glat + " // " + glon, Toast.LENGTH_LONG).show(); gpStation = new GeoPoint((int) (glat * 1E6), (int) (glon * 1E6)); marker = getResources().getDrawable(R.drawable.ic_station_pixelart); stationsOverlay = new ItemizedOverlayStation(marker, name, this); stationsOverlay.addPoint(gpStation); mMap.getOverlays().add(stationsOverlay); mController.setCenter(gpStation); mController.setZoom(15); // adding me= MyLocation(GPS) and also a compass ... myLocationOverlay = new FixedMyLocationOverlay(this, mMap); myLocationOverlay.enableMyLocation(); myLocationOverlay.enableCompass(); mMap.getOverlays().add(myLocationOverlay); stationDetailDialog(name, 0); }