Search in sources :

Example 1 with SupportMapFragment

use of com.google.android.libraries.maps.SupportMapFragment in project android-samples by googlemaps.

the class CloudBasedMapStylingDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        currentMapType = savedInstanceState.getInt(MAP_TYPE_KEY);
    }
    // The underlying style the map will use has been set in the layout
    // `cloud_styling_basic_demo` under the SupportMapFragment's `map:mapId` attribute.
    setContentView(R.layout.cloud_styling_basic_demo);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
    setUpButtonListeners();
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment)

Example 2 with SupportMapFragment

use of com.google.android.libraries.maps.SupportMapFragment in project android-samples by googlemaps.

the class StyledMapDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (savedInstanceState != null) {
        mSelectedStyleId = savedInstanceState.getInt(SELECTED_STYLE);
    }
    setContentView(R.layout.styled_map_demo);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment)

Example 3 with SupportMapFragment

use of com.google.android.libraries.maps.SupportMapFragment in project android-samples by googlemaps.

the class UiSettingsDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.ui_settings_demo);
    mMyLocationButtonCheckbox = (CheckBox) findViewById(R.id.mylocationbutton_toggle);
    mMyLocationLayerCheckbox = (CheckBox) findViewById(R.id.mylocationlayer_toggle);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment)

Example 4 with SupportMapFragment

use of com.google.android.libraries.maps.SupportMapFragment in project android-samples by googlemaps.

the class VisibleRegionDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.visible_region_demo);
    mMessageView = (TextView) findViewById(R.id.message_text);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
    new OnMapAndViewReadyListener(mapFragment, this);
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment)

Example 5 with SupportMapFragment

use of com.google.android.libraries.maps.SupportMapFragment in project android-samples by googlemaps.

the class ProgrammaticDemoActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    // It isn't possible to set a fragment's id programmatically so we set a tag instead and
    // search for it using that.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentByTag(MAP_FRAGMENT_TAG);
    // We only create a fragment if it doesn't already exist.
    if (mapFragment == null) {
        // To programmatically add the map, we first create a SupportMapFragment.
        mapFragment = SupportMapFragment.newInstance();
        // Then we add it using a FragmentTransaction.
        FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
        fragmentTransaction.add(android.R.id.content, mapFragment, MAP_FRAGMENT_TAG);
        fragmentTransaction.commit();
    }
    mapFragment.getMapAsync(this);
}
Also used : SupportMapFragment(com.google.android.libraries.maps.SupportMapFragment) FragmentTransaction(androidx.fragment.app.FragmentTransaction)

Aggregations

SupportMapFragment (com.google.android.libraries.maps.SupportMapFragment)27 RadioGroup (android.widget.RadioGroup)1 OnCheckedChangeListener (android.widget.RadioGroup.OnCheckedChangeListener)1 FragmentTransaction (androidx.fragment.app.FragmentTransaction)1 GoogleMap (com.google.android.libraries.maps.GoogleMap)1 OnMapReadyCallback (com.google.android.libraries.maps.OnMapReadyCallback)1 OnStreetViewPanoramaReadyCallback (com.google.android.libraries.maps.OnStreetViewPanoramaReadyCallback)1 StreetViewPanorama (com.google.android.libraries.maps.StreetViewPanorama)1 SupportStreetViewPanoramaFragment (com.google.android.libraries.maps.SupportStreetViewPanoramaFragment)1 LatLng (com.google.android.libraries.maps.model.LatLng)1 MarkerOptions (com.google.android.libraries.maps.model.MarkerOptions)1