B4A Library Digital Ink Recognition based on ML Kit



This is a B4A class that wraps ML Kit digital ink recognition. More information here: https://developers.google.com/ml-kit/vision/digital-ink-recognition

This feature has a large set of dependencies. I recommend starting with a simpler feature such as this one: https://www.b4x.com/android/forum/threads/b4x-textrecognition-based-on-mlkit.161210/#content
Once you get it working you can continue with the digital ink feature.

Open B4A Sdk Manager and install the following resources (you might need to install a few more resources. If you get a "missing module" during compilation then install it):
B4X:
androidx.work:work-gcm
androidx.work:work-multiprocess
androidx.room:room-runtime
androidx.room:room-common
androidx.room:room-compiler
androidx.room:room-compiler-processing
androidx.room:room-compiler-processing-testing
androidx.room:room-guava
androidx.room:room-gradle-plugin
androidx.room:room-migration
androidx.room:room-paging
androidx.room:room-paging-android
androidx.room:room-ktx
androidx.room:room-paging-guava
androidx.room:room-paging-rxjava2
androidx.room:room-runtime-android
androidx.room:room-paging-rxjava3
androidx.room:room-rxjava2
androidx.room:room-rxjava3
androidx.room:room-testing
androidx.room:room-testing-android
androidx.sqlite:sqlite
androidx.sqlite:sqlite-android
androidx.sqlite:sqlite-framework
androidx.sqlite:sqlite-framework-android
androidx.sqlite:sqlite-ktx
androidx.paging:paging-common
androidx.paging:paging-common-android
androidx.paging:paging-common-ktx
androidx.paging:paging-compose
androidx.paging:paging-compose-android
androidx.paging:paging-guava
androidx.paging:paging-runtime
androidx.paging:paging-runtime-ktx
androidx.paging:paging-rxjava2
androidx.paging:paging-rxjava2-ktx
androidx.paging:paging-rxjava3
androidx.paging:paging-testing
androidx.paging:paging-testing-android
androidx.compose.animation:animation
androidx.compose.animation:animation-android
androidx.compose.animation:animation-core
androidx.compose.animation:animation-core-android
androidx.compose.animation:animation-graphics
androidx.compose.animation:animation-graphics-android
androidx.compose.animation:animation-tooling-internal
androidx.paging:paging-common-jvm
androidx.paging:paging-testing-jvm
androidx.work:work-runtime
androidx.work:work-runtime-ktx
androidx.work:work-rxjava2
androidx.work:work-rxjava3
androidx.work:work-testing

Usage is quite simple and demonstrated in the attached example.
The app collects a list of strokes which are then processed with a call to recognizer.Recognize. The top 10 candidates are returned.

It supports many languages: https://developers.google.com/ml-kit/vision/digital-ink-recognition/base-models#text
The language model is downloaded if needed.
Don't miss the manifest editor snippet.
 

Attachments

  • DigitalInk.zip
    183.1 KB · Views: 28

Mehrzad238

Active Member
androidx.room
Hello, I am getting an error while trying to install resources.

HTML:
<!DOCTYPE html>
<html lang=en>
  <meta charset=utf-8>
  <meta name=viewport content="initial-scale=1, minimum-scale=1, width=device-width">
  <title>Error 404 (Not Found)!!1</title>
  <style>
    *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/logos/errorpage/error_logo-150x54-2x.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}
  </style>
  <a href=//www.google.com/><span id=logo aria-label=Google></span></a>
  <p><b>404.</b> <ins>That’s an error.</ins>
  <p>  <ins>That’s all we know.</ins>

This error comes from at least 10 of them or more
In the end, I got stuck at

B4X:
Maven artifact not found: androidx.sqlite/sqlite
Source: androidx.room:room-runtime
 

Attachments

  • Screenshot 2025-01-20 001244.png
    179.4 KB · Views: 17
  • fullerror.txt
    12.2 KB · Views: 7

Mehrzad238

Active Member
Tools - B4A Sdk Manager - install the missing artifact. There are many resources that you will need to install.
I know what must be done the problem is it does not download the resources( only 7 of them remains, i installed the rest of them ),I attached the screenshot on post #5
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…