LocalModel.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Object
|
clone()
|
boolean |
|
void |
finalize()
|
final Class<?>
|
getClass()
|
int |
hashCode()
|
final void |
notify()
|
final void |
notifyAll()
|
String
|
toString()
|
final void |
wait(long arg0, int arg1)
|
final void |
wait(long arg0)
|
final void |
wait()
|
Public Methods
Builds an instance of LocalModel
with provided info.
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.
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.
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.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eLocalModel.Builder\u003c/code\u003e is used to construct instances of \u003ccode\u003eLocalModel\u003c/code\u003e for using custom machine learning models in your Android app.\u003c/p\u003e\n"],["\u003cp\u003eYou must specify the model's location using one of the provided methods: \u003ccode\u003esetAbsoluteFilePath\u003c/code\u003e, \u003ccode\u003esetAbsoluteManifestFilePath\u003c/code\u003e, \u003ccode\u003esetAssetFilePath\u003c/code\u003e, \u003ccode\u003esetAssetManifestFilePath\u003c/code\u003e, or \u003ccode\u003esetUri\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eOnce the model's location is set, call \u003ccode\u003ebuild()\u003c/code\u003e to create the \u003ccode\u003eLocalModel\u003c/code\u003e instance.\u003c/p\u003e\n"],["\u003cp\u003eEnsure your asset model files are not compressed for proper loading.\u003c/p\u003e\n"]]],[],null,["# LocalModel.Builder\n\npublic static class **LocalModel.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \nBuilder class of [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel).\n\nOnly call one of [setAbsoluteFilePath(String)](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAbsoluteFilePath(java.lang.String)), [setAbsoluteManifestFilePath(String)](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAbsoluteManifestFilePath(java.lang.String)), [setAssetFilePath(String)](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAssetFilePath(java.lang.String)), [setAssetManifestFilePath(String)](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAssetManifestFilePath(java.lang.String)) and [setUri(Uri)](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setUri(android.net.Uri)). \n\n### Public Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------|\n| | [Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#Builder())() |\n\n### Public Method Summary\n\n|-------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel) | [build](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#build())() Builds an instance of [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel) with provided info. |\n| [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder) | [setAbsoluteFilePath](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAbsoluteFilePath(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) absoluteFilePath) Sets the absolute file path of the local model file. |\n| [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder) | [setAbsoluteManifestFilePath](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAbsoluteManifestFilePath(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) absoluteManifestFilePath) Sets the absolute file path of the local model's manifest file. |\n| [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder) | [setAssetFilePath](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAssetFilePath(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) assetFilePath) Sets the asset subpath of the asset model file. |\n| [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder) | [setAssetManifestFilePath](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setAssetManifestFilePath(java.lang.String))([String](//developer.android.com/reference/java/lang/String.html) assetManifestFilePath) Sets the asset subpath of the asset model's manifest file. |\n| [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder) | [setUri](/android/reference/com/google/mlkit/common/model/LocalModel.Builder#setUri(android.net.Uri))([Uri](//developer.android.com/reference/android/net/Uri.html) uri) Sets the URI of the model file. |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **Builder** ()\n\nPublic Methods\n--------------\n\n#### public [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel)\n**build** ()\n\nBuilds an instance of [LocalModel](/android/reference/com/google/mlkit/common/model/LocalModel)\nwith provided info. \n\n#### public [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder)\n**setAbsoluteFilePath** ([String](//developer.android.com/reference/java/lang/String.html) absoluteFilePath)\n\nSets the absolute file path of the local model file. \n\n#### public [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder)\n**setAbsoluteManifestFilePath** ([String](//developer.android.com/reference/java/lang/String.html) absoluteManifestFilePath)\n\nSets the absolute file path of the local model's manifest file. \n\n#### public [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder)\n**setAssetFilePath** ([String](//developer.android.com/reference/java/lang/String.html) assetFilePath)\n\nSets the asset subpath of the asset model file.\n\nMake sure your model asset file is not compressed by using aaptOptions. For more\ndetails, refer to [documentation](/ml-kit/vision/auto-ml-vision-edge/android#configure-a-local-model-source). \n\n#### public [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder)\n**setAssetManifestFilePath** ([String](//developer.android.com/reference/java/lang/String.html) assetManifestFilePath)\n\nSets the asset subpath of the asset model's manifest file.\n\nMake sure your asset file is not compressed by using aaptOptions. For more details,\nrefer to [documentation](/ml-kit/vision/auto-ml-vision-edge/android#configure-a-local-model-source). \n\n#### public [LocalModel.Builder](/android/reference/com/google/mlkit/common/model/LocalModel.Builder)\n**setUri** ([Uri](//developer.android.com/reference/android/net/Uri.html) uri)\n\nSets the URI of the model file.\n\nURI schemes can be content, android.resource or file. [MlKitException](/android/reference/com/google/mlkit/common/MlKitException)\nwith error code [MlKitException.NOT_FOUND](/android/reference/com/google/mlkit/common/MlKitException#NOT_FOUND)\nwill be thrown when loading model if URI scheme is not one of 3 supported schemes."]]