Get state of soft input keyboard on Android - android

I have an EditText in my Android app, with a normal keyboard attached to it, e.g. there are no custom filters, or other restrictions set on it. I would like to find out if the user uses the QWERTY keyboard, or she switched to another type, for example to the one where the numbers are displayed, and other special characters. Is this possible?
Thanks.

Related

Android keyboard input weird behaviour

I notice Android devices' default keyboard behave in a different ways, but I have 1 particular behaviour that I am unsure what it is and how to configure the keyboards settings. See the info below.
When Click in any edittext to get focus, the Keyboard shows up
When I type "Hello", the edittext don't get filled with the text immediately. I need to click the suggested "Hello" and then the text shows up in the edittext
Questions:
What are the settings to make the keyboard behave this way?
Is this behaviour the same on all Android keyboards? (I think no but, I
don't find any supporting references)
Do you guys know any 3rd party keyboard app that has this feature?
How to know if the user is using this type of keyboard?
To detect user interaction I use a combination of (1)onUserInteraction() and a (2)custom TextWatcher implementation. Both are tested and working so I didn't add the source codes. I mentioned the 2 above because those kind of keyboards with that behavior textchanges cannot be detected.
From the screenshots above "Hello" will only show when you click the green "Hello" in the left screenshot.

Disable speech to text button (Micro phone) on soft input keyboard in android programmatically

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"

Per-application input setting on Android Device

Android keyboard has a button that switches the input language. How can I change the input language
programmatically without using this button? My app has different textboxes where the user enters information in different languages and when the user switches from one field to another the input language will be changed automatically to the correct one.
Android keyboard is a stand-alone application, so I need to manage this language changing from my application. The only thing that I found is switchToNextInputMethod() method in InputMethodManager class but I'm not sure if it fits.

Android soft keyboard obscures input fields in mobile HTML5 web app

I am writing a mobile HTML5 web application to run on both Apple and Android. On the Android device I am testing on, I am having the following issue:
I have an input web control text box located in the lower 50% of the screen. When the focus goes to the text box, the soft keyboard is displayed and obscures/covers up/hides the input web control for which the user is supposed to be typing into. Only when the user types in at least one character does the input web control become visible and no longer hidden underneath the keyboard.
What I want is for the field being entered NOT to be obscured by the keyboard. When the soft keyboard is displayed, I want the input web control to remain visible.
This is on a Samsung tablet running Android version 3.2.
Please tell me how to accomplish this.
The simplest way to solve this android (and now ios7 too) nasty is to use the inputs focus and blur events. if you don't have a footer tag change to a class.
In jQuery:
$("input").focus(function(){
$('footer').hide();
});
$("input").blur(function(){
$('footer').show();
});

can one prevent the Android device emulator from popping up the onscreen keyboard?

I am developing an Android application. What I find most annoying during testing is, that the emulator always pops up that on-screen telephone keyboard whenever I click into a text input field. Since I input my data with the keyboard anyway I find that most annoying. Can one switch that on-screen keyboard appearance off? Or can one change that so that it at least presents a mini-qwerty keyboard as my actual device does, not that old-fashioned T9 keyboard?
Michael
You can disable the virtual keyboard in Settings->Language.
If you change orientation of the emulator it won't popup (KEYPAD_7, Ctrl-F11).
If you use cursor keys instead of clicking the fields, probably won't popup either.
Whatever you do, keep in mind that in actual devices it usually pops up anyway.

Categories

Resources