Android: input field does not fire event when hitting 'next' on keyboard - android

I have multiple input fields on a html page optimized for Android.
The problem is that the event "onchange" is not always triggered when 'next' is clicked on the virtual keyboard.
To me this seems to be a similar to issue 7459 of the Android browser:
http://code.google.com/p/android/issues/detail?id=7459
How can I circumvent or compensate this issue? I need to calculate and refresh another input field in the function calc() after the value of any of the fields has been changed. If available even Android specific events or behaviours can be used.
Thanks, Holger

Related

How do I disable text composition in an html textarea when on android?

I am using the input event on a textarea to apply some logic that mutates the value of the textarea. This works as expected in local dev environment in a browser.
However, my target platform is android. On this platform, I'm noticing that instead of event.inputType being insertText, sometimes it is insertCompositionText. Android is apparently trying to be efficient by not actually mutating the textarea's value until you press space. How can I disable this behavior?
I found someone in a similar situation here who tried to use blur and focus events quickly. I can't use this because (1) it's hacky, hope there is a better solution (2) it resets the cursor position and degrades the user experience.
For reference, using ionic vue, but this is just an html <textarea>:
<textarea v-model="input" #input="onInput" />
onInput(event) {
console.log("onInput", event);
//more logic
}
You can't. That behavior comes from the keyboard, which is a separate app on Android. Not implementing the composing text functionality correctly will likely screw it up, breaking autocomplete, tap to correct, and the delete key, which all behave much differently due to composing text. It might even break normal typing- the idea of composing text is that it's temporary until you make it permanent. If so, when it does autocorrect on space it would assume the old stuff is deleted and recommit the entire word, causing duplication.
I was able to handle this issue by adding a hidden password input and route all the focus, events and value of my text input to the password input
The browsers will not show any predictive for password inputs and no insertCompositionText anymore

Auto scrolling to active in-focus elements does not work on Android browsers

On iOS, touching the input field would trigger the soft-keyboard and auto scroll to the current in-focus element.
However, on Android browsers (Native or Chrome), touching the input field would trigger the soft-keyboard, but it scrolls to a wrong position so that the input is covered by the keyboard.
DEMO here
I know that if I take out the overflow:scroll from the parent class it works well. But how to solve this if I need to keep the overflow ?

Is there anyway using html5 to force android/ios virtual keyboard to be shown

I have some html forms that when they get rendered I would like the keyboard to appear without the user having to touch the field first. I have tried using click and focus neither brings up the keyboard.
For what its worth I am using angular.
I do not believe this is possible with out a very kludgy work around. You might be able to have a hidden text field that it set to focus, which would bring up the keyboard and then manually set focus on other items in the view when needed. However this might cause some issues and you might be able to see the cursor in the hidden text field, among other issues. Why do you need the keyboard to be displayed without a focus on some field?

How to get an event for soft keyboard KEYCODE_DEL?

I asked this previously on the Android dev mailing list but got no reply.
In my application, I bring the soft keyboard on from time to time, and
it looks like events for the DEL key are not delivered. The method in
question is at
http://pastebin.com/zZaZWJ4t
and the whole Java class is at
http://squeakvm-tablet.googlecode.com/hg/project/src/org/squeak/android/SqueakView.java
Any alphanumeric key or Enter (Return) tapped on the soft keyboard is
passed to the application except for KEYCODE_DEL. I tried to replace
KEYCODE_DEL in the case clause with anything else (e. g. with code for
for hardware button PAGE_UP), and the clause takes control when that
button is pressed.
I did not subclass the Android Keyboard class, just used the default
input manager.
What can be done in order to receive events for KEYCODE_DEL? Is
deriving a keyboard subclass the only way?
Thanks.
I had a similar issue and I was able to solve it by adding a TextWatcher to EditText using addTextChangedListener.
Your onCreateInputConnection() override is not returning TYPE_NULL as the input type. You must use TYPE_NULL to be assured that key events will be generated. They are in fact generated for some keys and not for others, in some versions of Android but not others, but there is nothing that you can count on about that unless you use TYPE_NULL.
If you do adjust your code to use TYPE_NULL, then please see this description of a workaround for two bugs in certain versions of the default LatinIME Google Keyboard that affect TYPE_NULL processing:
Android - cannot capture backspace/delete press in soft. keyboard

How to use OnKeyboardActionListener?

Simply say, is there any example about 'OnKeyboardActionListener'?
I want to call my method, whenever user type any character on keyboard.
OnKeyListener or OnKeyDown is not called when the word is composing. <- it's a problem.
So, I'm trying to use 'OnKeyboardActionListener' to solve the problem above.
Simply say, is there any example about
'OnKeyboardActionListener'?
This interface is used in the creation of input method editors ("soft keyboards"). The SoftKeyboard sample that shipped with your SDK uses this interface.
I want to call my method, whenever
user type any character on keyboard.
If this is your own keyboard, follow the SoftKeyboard example.
OnKeyboardActionListener is for implementing software keyboards.
OnKeyListener and OnKeyDown do not get called, as you have discovered, when using a software keyboard. They only get called when using a hardware keyboard, which many Android devices don't even have.
I assume what you are trying to do is capture key events as they are occurring in an EditText area. Your best bet in this case, in order to handle both software keyboard input and hardware keyboard input, is to register a TextWatcher via the addTextChangedListener() method.
Note that on phones with Android 2.1 and later, such as the Nexus One, people have the option of using speech recognition to input text into your EditText instead of typing the text. When they do that you may get full words, or even full sentences, entered all at once. So you need to check the entire contents of the EditText field when there is a change to the contents.

Categories

Resources