Is there a possibility for an android app to run as a service in the background, intercept keydown events from the hardware keyboard and change behavior (i.e. the resulting character) in some special cases?
The idea in mind is to have sort of a keyboard layout fix, mainly making important special characters available using an alternative keymap instead of having to select from a huge grid on the touch screen. Sometimes, the default keymap of a mobile devices do not represent all important characters, even more when it comes to non-english languages.
Thanks for inspiration :)
Peter
EDIT: additionally emphasized hardware
What you are describing is in fact not a service in background but replacing the keyboard app itself..take a look at the SWype app.
You do not have to create a service to do this as you want just the your own keyboard layout coming up when entering text, etc.
The sample of replacing a default app in the sdk is the homescreen but the keyboard app can be replaced as well..
Related
Thanks in advance for the help.
I am developing an android application for research purposes and need to disable the speech to text button on the soft input keyboard. The reason for this is due to concurrency issues that arise since the application I am developing uses the microphone. I understand that for a general application disabling keys is generally seen as impossible (since users may change default keyboards). I know for a fact that the default keyboard will be used.
With this in mind is it possible to disable certain keys? I believe that at the least I should be able to specify the input type such that the microphone button is hidden. I say this because if I disable speech to text in the settings (not programmatically, but manually as a user) the microphone icon is removed from the keyboard. I'm open to any possible solution (with the exception of not using the default keyboard) as this application will not appear on the play store.
You can't force the user input through anything other than pre-defined keyboards that already exist in the user's device.
The only way you could get around this is by programming your own custom, on-the-fly keyboard, and that is a very bad idea.
Just disable voice input programmatically by using XML declarations in the EditText you're looking at. You can do this with the attribute:
android:privateImeOptions="nm" // nm stands for No Microphone.
If you want to set it programmatically you can try this::
// deprecated i guess
edt_txt.setPrivateImeOptions("nm");
// this one is new but it works only with Google Keyboard.
edt_txt.setPrivateImeOptions("com.google.android.inputmethod.latin.noMicrophoneKey");
You can combine values in PrivateImeOptions parameter in CVS form so best option is to use:
edt_txt.setPrivateImeOptions("nm,com.google.android.inputmethod.latin.noMicrophoneKey");
Take a look through here and see if you can find what you're looking for.
More info about Google Keyboard here -> look for method setOptions
To disable microphone button on multiple keyboard. Use property
android:privateImeOptions="nm"
But it will not work for Gboard(google native keyboard)
To disable on microphone on Gboard use
android:privateImeOptions="nm"
editText.setImeOptions(IME_FLAG_NO_PERSONALIZED_LEARNING)
Just use this in your editText on the layout file:
android:imeOptions="flagNoPersonalizedLearning"
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.
For large size screens, the default android keyboard automatically displays Tab keys. I have a phonegap application which contains several input boxes on one page. When I try to navigate between input boxes using tab key on soft-keyboard, nothing happens.
I also tried to open gmail login page on browser and Tab key didn't shift focus there as well. However, I noticed that only in case of input boxes, I had to use shift+tab key to navigate to next input box. For navigating between other elements, just pressing tab key was sufficient. Is this the specific behavior implemented by android & is there any particular reason for it? I am using nexus 10 but found same behavior on emulator too.
I think this is a problem with Nexus 10 in particular, as I observe the same thing and here is another user that reports the same (https://stackoverflow.com/questions/16651669/nexus-10-keyboard-tab-key-not-working).
Tab key does work on native Android apps as it is supposed to, but not on hybrid apps which are basically wrapped in WebView. I think this is an oversight from the Android team. You can always install a Swipe or Hackers keyboard from the Play Store where the Tab key does the job.
This seems to be an issue specific to Android Tablet devices. A workaround I found was to change the keyboard mode to either split or floating. Also I noticed flipping the device around to landscape view allows the input elements to behave correctly.
The original issue is related to the viewport size change that happens when any input receives focus which is caused by this so-called soft keyboard. Android seems to handle the rendering of a soft keyboard differently from other manufacturers.
I'm running a webapp on Android galaxytab.
I have 3 textbox with FocusHandler-s erasing the textbox content onFocus.
This works well but if the user uses the tab, previous or next buttons on the device's keyboard, the FocusEvent is not triggered.
I tried to catch Key events to prevent default action on TAB but the tab key is not triggerd either.
Does anyone know how to trigger a FocusEvent on tab or previous/next key press on an Android device keyboard? (Everything works well in computer's browser even if using tab key the focus event is triggered but not in Android's browser).
While this isn't a fix for your FocusHandler issue, if the content in the textbox that is being erased is a placeholder, perhaps you can benefit from this answer.
Take a look at http://www.m-gwt.com
The library provides placeholders for input elements in gwt.
I have a login screen on my app which accepts a CPF as login (CPF is an unique number identification that every Brazilian citizen have, e.g: 10546819546), but it can also accept passport numbers as the login, and these may have letters on it.
My problem is that I want the keyboard, when it pops up, to show to number/symbols "view" before the default alphabet one. Changing the inputMethod to phone or number does not solve my problem, because as I said, the login may contain letters.
I've seen some explanations to questions somewhat similar to mine but all of them either didn't solve my problem or it was too overcomplicated.
This is merely a small adjust to slightly improve user experience and entertain me developing the app, so if the solution is something like "override the default keyboard, make a custom component" etc, I'll just leave it alone.
TL;DR: I want to show the number/symbol soft keyboard before the letters one.
Unfortunately when it comes to the soft keyboard you are somewhat at the mercy of whoever made the one the user has their device set to. Lots of devices come pre-loaded and defaulted to the swype keyboard. But many others have soft keyboards that were made by the manufacturer of that device. It it up to whoever created it to decide how the keyboard reacts to the android:inputType that you pass to it. It is possible that some of the ones out there right now actual have the behavior you are looking for when you set them to number or phone. I just checked it out on my sidekick and found that it was the same as yours both number and phone provided no way to input letters.