Use Android's or Google's predictive text

My app is a simple letterboard to facilitate communication in a specific therapeutic scenario. It provides visual and audio feedback (i.e. selectable text-to-speech of letters and words and "click" sounds) and will be linked to a wearable, vibrating mini disc, for haptic feedback (via Bluetooth in an Arduino MCU).

The users of this app have specific motor and communication challenges so typing requires a lot of effort and concentration. Adding predictive text, like that of Android's text messaging or Google's search would be of great help.

The Autocomplete Textbox extension and other solutions I found in the forum are geared towards a different problem and so entail a preset (limited) list of words (i.e., tinyDB, etc.)

Is there a way to incorporate Android's or Google's predictive text into the app? The app is used on one device only: an e-ink tablet with Android 11.

Below a screenshot and attached the app for reference.

customKeyb2.aia (49.1 KB)

you need an extension to listen to the textbox.change event.

Initialize global history to empty list;

when screen.initialized
set history to tinydb.getvalue(tag:history)

when textbox.textchanged
iterate the history list to find all the items starting with the textboxt.text and show them

when you press enter (or complete input the text),
add the textbox.text to history, if the history not contains this text
tinydb.savevalue(tag:history, value:history)

1 Like

Hi @Kevinkun. Thanks for your method to create and use a predictive-text list of words!
A couple of questions

  1. I thought tinyDB had a one-to-one relation (TAG:Value). You're saying that I can store a LIST of values under the same TAG? (TAG:Value1, Value2, etc.)? If so, how are the Values separated? (Comma, Tab, special char, etc.)
  2. What is the limit number of records (or values within each TAG) that tinyDB can reasonably hold? I'm thinking of pre-populating the list with the most common x-hundred or thousand words.


@Kevinkun I just found the answers to my questions. Many thanks!

Store multiple values in TinyDB

Read from TinyDB multiple values

TinyDB record format and max size

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.