I can't change the map type on my Android Application, everything work fine but this feature is not.
This is a part of the MapActivity class
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN );
this.locationManager = (LocationManager) getSystemService(LOCATION_SERVICE);
mMapFragment = MapFragment.newInstance();
setContentView(R.layout.activity_map_fabio);
options.mapType(GoogleMap.MAP_TYPE_NORMAL)
.compassEnabled(true)
.scrollGesturesEnabled(true)
.zoomGesturesEnabled(true)
.tiltGesturesEnabled(true);
MapFragment.newInstance(options);
mMap = ((SupportMapFragment) getSupportFragmentManager()
.findFragmentById(R.id.map)).getMap();
android.app.FragmentTransaction fragmentTransaction =
getFragmentManager().beginTransaction();
fragmentTransaction.add(R.id.map, mMapFragment);
fragmentTransaction.commit();
satellite = (CheckBox) findViewById(R.id.satellite);
satellite.setOnCheckedChangeListener(new OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
if (satellite.isChecked()){
mMap.getUiSettings().setAllGesturesEnabled(true);
options.mapType(GoogleMap.MAP_TYPE_SATELLITE);
}
}
});
The check is listened but the map doesn't change the view.
.
stackoverflow.comm
No comments:
Post a Comment