Unable to use The new BubbleIconFactory its giving deprecated
dependency Gradle build file:
dependencies {
compile 'com.google.maps.android:android-maps-utils:0.4+'
}
// want to use this
BubbleIconFactory bubbleIconFactory = new BubbleIconFactory(this);
BubbleIconFactory
is deprecated. You can use IconGenerator
instead:
IconGenerator iconFactory = new IconGenerator(this);
MarkerOptions markerOptions = new MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(iconFactory.makeIcon("Your text here")))
.position(new LatLng(40, -4))
.anchor(iconFactory.getAnchorU(), iconFactory.getAnchorV());
mMap.addMarker(markerOptions);
Here you can find the official demo activity.
BubbleIconFactory
is deprecated in Java. and yes as @antonio mentioned, use IconGenerator
.
Dependency: implementation 'com.google.maps.android:android-maps-utils:0.5'
In Java
IconGenerator iconGenerator = new IconGenerator(context);
// You can style icon using the IconGenerator.STYLE_BLUE
iconGenerator.setStyle(IconGenerator.STYLE_BLUE);
MarkerOptions markerOptions = new MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon("Your text here");))
.position(new LatLng(-33.8523341, 151.2106085)) // Sydney, Australia
.anchor(iconGenerator.getAnchorU(), iconGenerator.getAnchorV());
mMap.addMarker(markerOptions);
In Kotlin
val iconGenerator = IconGenerator(this)
// You can style icon using the IconGenerator.STYLE_BLUE
iconGenerator.setStyle(IconGenerator.STYLE_GREEN)
val markerOptions = MarkerOptions()
.icon(BitmapDescriptorFactory.fromBitmap(iconGenerator.makeIcon("Text here")))
.position(LatLng(-33.8523341, 151.2106085)) // Sydney, Australia
.anchor(iconGenerator.anchorU, iconGenerator.anchorV)
mMap.addMarker(markerOptions)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With