Android Question EditText How to disable text selectable

dpann

Member
Licensed User
Hi All,
I want to disable the "selectability" of an EditText
I tried both following codes without any success (the EditText remains selectable if I make a long touch on the text)

Code 1 :
Dim jo As JavaObject = EditText1
' jo.RunMethod("setTextIsSelectable", Array As Object(False))

Code 2 :
Dim r As Reflector
r.Target = EditText1
r.RunMethod2("setTextIsSelectable",False,"java.lang.boolean")

Thanks for your help
 

dpann

Member
Licensed User
1. Finally, I found the solution. It seems there is a bug in the SDK, therefore you need to make it Selectable before making it not Selectable.
The following snippet works :

B4X:
Dim jo As JavaObject = EditText1
' jo.RunMethod("setTextIsSelectable", Array As Object(True))
' jo.RunMethod("setTextIsSelectable", Array As Object(False))
2. I wanted to make it not Selectable to disable the "Long touch" event which shows the two selection handles but it disable everything ...
Finally, I found in the forum a good example of a custom EditText which can be configured exactly according to what you want.
 
Top