chore: Add snippets for MapID. (#769)

Change-Id: I434662a7d99ae3b333a8e53c97813f6eafed7d68
This commit is contained in:
Chris Arriola 2021-12-03 12:36:53 -06:00 committed by GitHub
parent 6857d37ff8
commit 8549ee6253
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,25 @@
package com.google.maps.example;
import android.content.Context;
import com.google.android.gms.maps.GoogleMapOptions;
import com.google.android.gms.maps.MapView;
import com.google.android.gms.maps.SupportMapFragment;
class MapId {
private void fragment() {
// [START maps_android_support_map_fragment_map_id]
GoogleMapOptions options = new GoogleMapOptions()
.mapId("YOUR_MAP_ID");
SupportMapFragment mapFragment = SupportMapFragment.newInstance(options);
// [END maps_android_support_map_fragment_map_id]
}
private void mapView(Context context) {
// [START maps_android_mapview_map_id]
GoogleMapOptions options = new GoogleMapOptions()
.mapId("YOUR_MAP_ID");
MapView mapView = new MapView(context, options);
// [END maps_android_mapview_map_id]
}
}

View File

@ -0,0 +1,24 @@
package com.google.maps.example.kotlin
import android.content.Context
import com.google.android.gms.maps.GoogleMapOptions
import com.google.android.gms.maps.MapView
import com.google.android.gms.maps.SupportMapFragment
internal class MapId {
private fun fragment() {
// [START maps_android_support_map_fragment_map_id]
val options = GoogleMapOptions()
.mapId("YOUR_MAP_ID")
val mapFragment = SupportMapFragment.newInstance(options)
// [END maps_android_support_map_fragment_map_id]
}
private fun mapView(context: Context) {
// [START maps_android_mapview_map_id]
val options = GoogleMapOptions()
.mapId("YOUR_MAP_ID")
val mapView = MapView(context, options)
// [END maps_android_mapview_map_id]
}
}