java.lang.IndexOutofBoundsException:setSpan(x...x) ends beyond length 1.

  • Create an Android Project under Android 11 (RS build 28.0.47991.2819 + Patch 1)

Drop a TTMSFMXEdit control on the form

Set KeyboardType to PhonePad / NumberPad / Decimal NumberPad (except Default Keyboard)

OnClick Event of the Control, Set SelectAll (TTMSFMXEdit(Sender).SelectAll)

Compile and Run the Application

When Clicked on the control, triggers the SelectAll Event and while pressing the keyboard keys for data entry gives the following error

java.lang.IndexOutofBoundsException:setSpan(x...x) ends beyond length 1.

  • x stands for the length of the data entered.

Is this reproducible with a normal TEdit?

No, It is not reproducible with TEdit / TNumberBox.
It happens only on TTMSFMXEdit.

I am having the same problem and has only started from install of Delphi 11.3. Works fine when compiled for Windows but not on Android device.

In my case, I have TTmsFMXEdit control with EditType set to etMoney (keyboard type is numberpad). I have set the OnTap event to set:


and this is where the error seems to occur. I want to select all so user can initially overwrite whatever has already been entered. Have discovered that if I remove the OnTap event then all works Ok but I really want to use the selectall method.

Nothing to do with TMS but also getting same error on FirePower (Woll2Woll) datagrid when entering an integer value larger than 9 (ie. more than one character) on an integer field.

Hope you are able to help.

Bill Zwirs

We have tested this here but I'm not able to reproduce this. Please provide a sample

This happens only under Delphi 11.3 and when SelectAll is applied under code on OnClick Event or SelectAll under the control and Enter Numbers (Default Keypad has no Issue)
Set KeyboardType to PhonePad / NumberPad / Decimal NumberPad.


For the time being, I have had to re-install back to Delphi 11.2 where the problem doesn't happen for this project. Have installed Delphi 11.3 on a new machine (nice clean install) but still happens there..

We have installed the latest version and the issue still persists on Delphi 11.3.
Can you check on this and update asap, we are waiting for some update on the issue.

We are currently setting up an environment for testing purposes. We'll look into this issue as soon as possible.


Have attached my test code for this problem. When compiled for Android and run on an Android tablet then the problem occurs. For your info ... I am using Android SDK 32 and my tablet (S6 Lite) has Android 13, UI version 5.1 although the issue also occurs on other Android versions.

Bill (11.4 KB)

We fixed the issue, next version of TMS FMX UI Pack will address this.

Thanks for your quick response. Looking forward to trying it out.