LocalModel.Builder

  • LocalModel.Builder is a builder class for creating instances of LocalModel.

  • When using the builder, you should only call one of the file path or URI setting methods.

  • The builder provides methods to set the absolute or asset file path for the model or its manifest file, or to set a URI for the model file.

  • The build() method is used to construct the LocalModel instance with the provided information.

public static class LocalModel.Builder extends Object

Public Constructor Summary

Public Method Summary

LocalModel
build()
Builds an instance of LocalModel with provided info.
LocalModel.Builder
setAbsoluteFilePath(String absoluteFilePath)
Sets the absolute file path of the local model file.
LocalModel.Builder
setAbsoluteManifestFilePath(String absoluteManifestFilePath)
Sets the absolute file path of the local model's manifest file.
LocalModel.Builder
setAssetFilePath(String assetFilePath)
Sets the asset subpath of the asset model file.
LocalModel.Builder
setAssetManifestFilePath(String assetManifestFilePath)
Sets the asset subpath of the asset model's manifest file.
LocalModel.Builder
setUri(Uri uri)
Sets the URI of the model file.

Inherited Method Summary

Public Constructors

public Builder ()

Public Methods

public LocalModel build ()

Builds an instance of LocalModel with provided info.

public LocalModel.Builder setAbsoluteFilePath (String absoluteFilePath)

Sets the absolute file path of the local model file.

public LocalModel.Builder setAbsoluteManifestFilePath (String absoluteManifestFilePath)

Sets the absolute file path of the local model's manifest file.

public LocalModel.Builder setAssetFilePath (String assetFilePath)

Sets the asset subpath of the asset model file.

Make sure your model asset file is not compressed by using aaptOptions. For more details, refer to documentation.

public LocalModel.Builder setAssetManifestFilePath (String assetManifestFilePath)

Sets the asset subpath of the asset model's manifest file.

Make sure your asset file is not compressed by using aaptOptions. For more details, refer to documentation.

public LocalModel.Builder setUri (Uri uri)

Sets the URI of the model file.

URI schemes can be content, android.resource or file. MlKitException with error code MlKitException.NOT_FOUND will be thrown when loading model if URI scheme is not one of 3 supported schemes.