Android Question Block Soft Keyboard Auto Correct

Cliff McKibbin

Member
Licensed User
The Auto Correct ability of Android makes it tough to enter text for some words.
As an example in the USA, 'PBS' is the public broadcasting network. When you enter 'PBS" in a normal text box, the android logic insists on changing it to bps. This is just one of many I have encountered as my apps all allow a fair amount of text entry.

The only way around is to keep typing and then at the end jump into the sentence and backspace it out and correct it. This can be very frustrating for users.


In a post for a similar question (Block or customize soft keyboard word suggestions) on March 8, 2019 by skrjabin, Erel wrote in a reply that:
1. You can disable the suggestions.
2. Use SearchView instead of AutoCompleteEditText.

I have enabled the IME library as some posts suggest and it does include the AutoCompleteEditText but not SearchView. I am not sure that is what I want anyway.

I would like to test the 'disable the suggestions', but I don't see any way to do that.

Thanks, Cliff and thanks for a great product.
 

Peter Simpson

Expert
Licensed User
Longtime User
@Cliff McKibbin
Lets say that your EditText box is called TxtName, then add this line to your Activity_Create after loading the layout, this should stop the auto corrections suggestions from appearing on the top of your Android soft keyboard when entering text into that specific text box.
B4X:
     TxtName.InputType = 0x00080000

Enjoy...
 
Upvote 0

Cliff McKibbin

Member
Licensed User
Thanks to Peter for the suggestion. It prompted me to check the 'Beginners Guide' for B4A and search for '0080000'. I found the text codes on page 381.

I first tired Peter's suggestion and it suppressed both 'suggestions' and 'auto correct'. However, it also converted my multi-line text box into single line.

I then logged out the value of a multi line text box and found it is dec 131073 hex 20001. I then added together the values Peter suggested of dec 524288 hex 80000 to get dec 655361 and hex a0001. This resulted in a multi-line text box with both suggestions and auto-correct suppressed. This would work but I would really like the suggestions just not the auto-correct.

Page 381 includes an entry to add auto-correct of dec 32768 hex 8000. Since auto-correct is a part of the standard text box, I thought that if I subtracted the auto-correct values from the standard text box values, I might get what I want. 131073-32768 =98305 hex 18001. I tried it and it reverted back to single line but still had the suggestions and auto correct.

I also tried subtracting the auto complete values of 65536/10000 from the standard multi line values to get 65537/10001. This gave the same result of single line and still suggestions and auto correct.

I am thinking that b4a is looking for the specific additive combinations from page 381 but not the subtractive.

If that is not the case, I would appreciate any hints, otherwise some of us would appreciate an update to handle multi line + suggestions, but dropping the auto-correct. It would seem it could be implemented with dec 98305 hex 18001

Thanks, Cliff

Side bar: Thanks to Vecino, March 1, 2014 "Convert number "long" to "hex"" for the instructions for displaying hex values. This is not covered in the beginner's manual that I can see.
Dim fNum As Long = 856987458515
Dim cStr As String
cStr = Bit.ToHexString( fNum )
Log("cStr: "&cStr) ' cStr: 886edbd3
 
Upvote 0
Top