File tree Expand file tree Collapse file tree 1 file changed +10
-9
lines changed
demo/src/main/java/com/google/maps/android/utils/demo Expand file tree Collapse file tree 1 file changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -97,18 +97,19 @@ private void setUpMap(Bundle savedInstanceState) {
9797 // 2. Call the getMapId() method
9898 String mapId = app .getMapId ();
9999
100+ // Create a new SupportMapFragment instance
101+ SupportMapFragment mapFragment ;
102+
100103 if (mapId == null ) {
101- finish (); // Note the main application will inform the user of the need for the map ID.
102- return ;
104+ mapFragment = SupportMapFragment .newInstance ();
105+ } else {
106+ // Create the map options
107+ GoogleMapOptions mapOptions = new GoogleMapOptions ();
108+ mapOptions .mapId (mapId );
109+ // Create a new SupportMapFragment instance
110+ mapFragment = SupportMapFragment .newInstance (mapOptions );
103111 }
104112
105- // Create the map options
106- GoogleMapOptions mapOptions = new GoogleMapOptions ();
107- mapOptions .mapId (mapId );
108-
109- // Create a new SupportMapFragment instance
110- SupportMapFragment mapFragment = SupportMapFragment .newInstance (mapOptions );
111-
112113 // Add the fragment to the container (R.id.map)
113114 // Check savedInstanceState to prevent re-adding on rotation
114115 if (savedInstanceState == null ) {
You can’t perform that action at this time.
0 commit comments