Reputation: 53943
I'm trying to add options to my xml-defined google map in my (first!) Android App. From Java I now want to change some options. I try to do this as follows:
GoogleMap mMap = null;
if (mMap == null) {
mMap = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap();
if (mMap != null) {
Log.wtf("DE MAP IS", "GECREEERD!!!");
GoogleMapOptions options = new GoogleMapOptions();
options.mapType(GoogleMap.MAP_TYPE_SATELLITE)
.compassEnabled(false)
.rotateGesturesEnabled(false)
.tiltGesturesEnabled(false);
mMap.newInstance(options);
}
}
Unfortunately I get an error at mMap.newInstance(options);
saying "The method newInstance(GoogleMapOptions) is undefined for the type GoogleMap".
Does anybody know how I can fix this? All tips are welcome!
Upvotes: 0
Views: 140
Reputation: 635
use this to select options
int mapType = GoogleMap.MAP_TYPE_SATELLITE;
FragmentManager manager = getSupportFragmentManager();
SupportMapFragment mapFragment = (SupportMapFragment) manager.findFragmentById(R.id.map);
map = mapFragment.getMap();
map.setMapType(mapType);
Upvotes: 1