How can I detect which language is use typing into EditText. I know the API 13 has getCurrentInputMethodSubtype, but what is the alternate for older versions?
There is none. And I wouldn't count on even that above working across all keyboards. I wrote a popular keyboard and have no idea where the framework would get that info from- there's no API for them to query what keyboard type we are or for us to update if we switched (say from a user using an in keyboard switch language shortcut).
The keyboard API is really Google's bastard stepchild. They don't seem to put a lot of thought into it, or work with other major keyboard makers when adding new functionality.
Related
I want to make a layout icon for Android phones with QWERTY keyboards, however Android policy concerning InputMethodManager is pretty strict, so I am trying to get the current language via the Accessibility, but I am stuck since the provided AccessibilityService.SoftKeyboardController can only tell you if the keyboard is shown.
Any ideas on how I can get the current layout from a service?
I found a workaround - when the layout changes a Toast notification is shown, so I've resorted to catching these notifications. It's a hack, but it works.
I wanted to open soft keyboard in Chinese languages in my android application which supports localization. Can any one please help me out.
There is no way to do it. The Keyboard is separated app and you have no way to tell it what language you want. Except situation when a keyboard has api's to do it. Your only variant in to write your own internal keyboard.
Anyway, if a system locale is Chinese - user in most cases already have Chinese keyboard so you don't need to worry about it.
I am developing an simple game using soft keyboard where people play with characters. So I want to change the background color of keys during the game. I know that there are tones of tutorials and questions out there answering to changing background and color of keys but my question is a bit different. Because I want to do it dynamically and I have had a hard time to figure out that how can I do it. I am using Android soft-keyboard but I don't know where and how can I add a listener to change the corresponding key's background. And how my game-engine sends this signal to the keyboard? Could you help me what should I do?
Thanks
Changing the appearance of the soft keyboard from your app will likely be impossible, especially on a per-key level as you describe.
The most feasible option would be to create a custom keyboard specifically for your application.
You could possibly get in touch with the developer of a keyboard app but it's unlikely they'd be willing to add a back door just for your game- and even if they were, your users would then be required to install that keyboard to play your game, which is not ideal.
I thought about implementing kind of a meta-soft-keyboard for android that first checks if a physical keyboard is connected (in my case a dock but bluetooth kbds should also be possible) and launches a specific other soft-keyboard if there isn't.
So:
Is there a way to get a list of all installed keyboards using the android API?
/edit: This seems to be possible using the InputMethodManager
Can I then call a specific one of these keyboards?
If there is no API solution, can it possibly be done on rooted phones/tablets?
Or do I have to implement my own full keyboard solution (or possibly fork/improve an existing open source one) that just doesn't pop up when there's a physical kbd connected)?
For those having similar troubles:
The best work-around solution I found so far is using the NULL keyboard and the Dock keyboard switcher apps. But the NULL keyboard currently only supports the english layout and the constant keyboard switcher popup gets kind of annoying... (IMO it's almost easier to just hide the keyboard everytime it appears)
Seems like it can be done by public boolean switchToNextInputMethod (IBinder imeToken, boolean onlyCurrentIme), but I don't know is it switching permanently or only for one time and this method is added only in Jelly Bean.
The default Messaging app in Android (tested against version 2.1) appears to put the soft keyboard in a special mode, where the return key is replaced with an "emoticon key". When you press it you get a selection of emoticons to insert into your message.
(source: futurenet.com)
How do I instruct the soft keyboard to appear in this mode in my app?
This is definitely an imeOption being set immediately on EditText. I don't know exactly which one it is, it doesn't seem to match any of the ones described here. You might be able to use Hierarchy Viewer to help you pin down what the exact options are.