3

I'm using the standard EditText control in my Android app. The input for this EditText should be inserted only from the built-in Keypad of the app.

When SwiftKey (third-party keyboard app) is installed on the device, it causing to strange behavior like a jumpy cursor, and underline below some text.

My question is, how can I avoid of any third-party keyboard effects in the EditText control.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Ben
  • 71
  • 1
  • 7

2 Answers2

1

Using TYPE_TEXT_FLAG_NO_SUGGESTIONS flag on EditText.InputType solved the issue.

Ben
  • 71
  • 1
  • 7
0

My question is, how can I avoid of any third-party keyboard effects in the EditText control.

You can't. The choice of the input method editor ("keyboard app") is up to the user, not you. AFAIK, there are some devices that ship with SwiftKey as the default.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • But I noticed that other apps on my device are not affected by SwiftKey (I assume that they use the same EditText). I will note that the EditText's input does not enter through the system's keyboard, So I looking a way to mute third-party keyboard effects (like auto-correct, jumpy cursor and unwanted underlines). – Ben Jan 29 '18 at 13:53
  • @Ben: "But I noticed that other apps on my device are not affected by SwiftKey" -- then perhaps you are doing something odd with your `EditText` that those apps do not. SwiftKey is used by millions of people across thousands of apps. If the problem that you are describing is common, most likely SwiftKey would have found out about the problem and fixed it. It is more likely that the problem is more specific to your situation. "So I looking a way to mute third-party keyboard effects" -- that is not possible in general, particularly across the hundreds of different third-party keyboards. – CommonsWare Jan 29 '18 at 13:58
  • Ok, thanks. Do you know an alternative component to EditText which not affected by the system keyboard? – Ben Jan 29 '18 at 14:47
  • @Ben: The only text entry component in Android is `EditText` (plus things that inherit from `EditText`). You might consider asking a separate Stack Overflow question where you provide a [mcve]. This would include your layouts and Java code associated with this `EditText`, plus *detailed* explanations of your symptoms, in hopes that somebody can suggest some settings that might help. There is no guarantee that those settings will solve anything across all keyboard implementations, though. – CommonsWare Jan 29 '18 at 14:55
  • Ok, thanks a lot for your explanations. I will keep this thread open for a while if anyone wants to add anything. – Ben Jan 29 '18 at 15:10
  • I found that use using TYPE_TEXT_FLAG_NO_SUGGESTIONS as InputType solved the problem. I will test it and will update later. – Ben Jan 29 '18 at 16:41