Class MapImageFactory
- Last UpdatedMay 13, 2025
- 2 minute read
Package com.here.sdk.mapview
- java.lang.Object
-
- com.here.sdk.mapview.MapImageFactory
-
public class MapImageFactory extends java.lang.Object
Convenience factory class for loading marker resources from various sources.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static MapImage
fromBitmap(android.graphics.Bitmap bitmap)
Creates a map image from a supplied Bitmap.static MapImage
fromFile(java.lang.String filePath, int width, int height)
Creates a map image from a specified SVG Tiny or PNG file path.static MapImage
fromResource(android.content.res.Resources resources, int resourceID)
Loads a map image from a specified bitmap resource ID.
-
-
-
Method Detail
-
fromResource
public static MapImage fromResource(android.content.res.Resources resources, int resourceID)
Loads a map image from a specified bitmap resource ID. As usual on Android, the PNG format is preferred. Vector drawables are not supported.- Parameters:
resources
- the application's resourcesresourceID
- resource ID for the bitmap image to load- Returns:
- map image representing specified image resource
-
fromFile
public static MapImage fromFile(@NonNull java.lang.String filePath, int width, int height) throws InstantiationErrorException
Creates a map image from a specified SVG Tiny or PNG file path. Trying to load data not compliant to SVG Tiny or PNG might result in undefined behavior. This method needs read storage permission to be granted.- Parameters:
filePath
- the path pointing to SVG Tiny filewidth
- preferred widthheight
- preferred height- Returns:
- map image representing specified image resource
- Throws:
InstantiationErrorException
- if dimension are invalid or path is empty.
-
fromBitmap
public static MapImage fromBitmap(@NonNull android.graphics.Bitmap bitmap)
Creates a map image from a supplied Bitmap.- Parameters:
bitmap
- the bitmap image to use for creating the marker resource- Returns:
- map image representing specified image resource
-
-