Panel | ||||||
---|---|---|---|---|---|---|
| ||||||
You might receive custom files of type This article gives step-by-step instructions showing the configuration in an Android activity. |
...
How to Configure the Custom .any
and .ale
Files
There are basically 2 ways to configure custom .any
- and -.ale
- files. :
The first one is via code (using methods in an Android activity)
...
.
The second one is declarative by extending the View Configuration.
This knowledge base article gives step-by-step instructions showing the configuration in an Android activity.
Info |
---|
The example shown below describes an OCR configuration. Custom |
Copy the the
.ale
file to the folderapp/src/main/assets
of your app.Check if there is a folder called
app/src/main/trained_models
. If it does not exist, create this folder.Copy the
.any
file to the newly created folderapp/src/main/trained_models
.Add the following statements to your Android activity:
Code Block language java ... private ScanView scanView; private OcrScanViewPlugin scanViewPlugin; io.anyline.plugin.ocr.AnylineOcrConfig anylineOcrConfig; ... scanView = findViewById(R.id.scan_view); ... // this is one way to set the view configuration file: try { scanView.init("your_view_configuration_file.json"); } catch (Exception e) { e.printStackTrace(); } ... anylineOcrConfig = new AnylineOcrConfig(); ... anylineOcrConfig.setCustomCmdFile("your_custom_file.ale"); anylineOcrConfig.setModel("your_custom_file.any"); // add further config settings ... scanViewPlugin = new OcrScanViewPlugin(getApplicationContext(), anylineOcrConfig, scanView.getScanViewPluginConfig(), "OCR"); ... scanView.setScanViewPlugin(scanViewPlugin);