Setting GoogleMapOptions programmatically
android, android-fragments, google-maps
Solution
I think you can use `GoogleMapOptions` only if you are creating map view programmatically(passing options to `MapFragment.newInstance()` method - docs). You are inflating `MapFragment` from xml so you wont be able to use them in that way. In your case you can still change map options by using `GoogleMap` setters or `UiSettings`.
For example:
GoogleMap googleMap = ((SupportMapFragment)getSupportFragmentManager().findFragmentById(R.id.map_fragment)).getMap();
googleMap.setMapType(GoogleMap.MAP_TYPE_SATELLITE);
googleMap.getUiSettings().setMyLocationButtonEnabled(true);
Problem
I am inflating my fragment like this: ``` GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.MapFragment_map_Fragment)).getMap(); ``` and here I have my options: ``` GoogleMapOptions options = new GoogleMapOptions(); options.mapType(GoogleMap.MAP_TYPE_SATELLITE); ``` In the documentation I see that I need to use this: To apply these options when you are creating a map, do one of the following: If you are using a MapFragment, use the MapFragment.newInstance(GoogleMapOptions options) static factory method to construct the fragment and pass in your custom configured options. But I don't understand how am I suppose to use this.