WebView and Detecting type of edit text in html? Keyboard type? - android

Part of my app has a form in WebView? How can I detect if the user is clicking on something in the html that should be numeric only? For example a zip code or credit card info? That way I could present them with the correct type of keyboard?

Basically you are trying to fix a missing implementation of HTML5 in android devices:
http://www.quirksmode.org/html5/inputs_mobile.html
this should give you a hint on how to call Java native functions from JS
http://developer.android.com/reference/android/webkit/WebView.html#addJavascriptInterface%28java.lang.Object,%20java.lang.String%29
I don't think you can progrematically change the keyboard input method when it's displayed.
This is one way to open the keyboard, but you'll need to handle the input and this will look bad as you won't see where you are typing.
Open soft keyboard programmatically
anoother way solve the issue of the keyboard type I would popup a native dialog with a textfield and set the keyboard type of this field to the one you need.
then send the result back to the webview by injecting javascript using loadURL();
at anycase you'll want to set the html field to readonly so it's keyboard doesn't jump.

Related

keyboard covering webview form in Android app

I have a webview of a form in an android app, but the problem is that when I open up the keyboard to type, it covers the other input fields. for the fields near the top, i can click on to type, but the last field is entirely covered by the keyboard, such that if I lower the keyboard and click on the input field in the webview, the keyboard will cover the field (I can type in it, but not see what I am typing)
does anyone have thoughts/guidance/resources on how to approach this problem?
alternatively, does anyone know how I could do something like the following: when I click a input field in a webview, for the keyboard to show right below the field for each field on the page.
I've seen some resources around adjustPan and adjustResize in windowSoftInputMode, but that didn't seem to solve it for me, though I could still be wrong. I am working with an sdk that gets the webview up, so there could be indirection that I am missing.

XWalkView change inputType method

In our android app we use XWalkView instead of standard WebView for better performance.
I'm looking for a way how to show text tips on keyboard when user input, which is disabled by default in XWalk, but presented in standard WebView.
And second problem, when using XWalk, keyboard has pressed shift by default.
Is there any way to show keyboard without shift and with tips like in WebView?
Sorry for my weak English.

Android: Pull out emoji keyboard on button press

I know that you can specify a short message input type in order to turn the enter key of the keyboard into an emoji button and pressing it will show up the emoji list but what i want to do is open up the emoji list programatically from a button. Is this possible?
There is no functionality to add tabs to any generic keyboard. Certain keyboards may support it, but it isn't a common feature. You could write your own fully custom keyboard, but that's a lot of work and will piss off many users.
Also, I'm not sure what you mean about by like in hangouts. I use hangouts- it doesn't do anything odd with my keyboard. It stays as Swype, there's no special emoji tab. It may be a feature of your favorite keyboard based on the input type (I assume both use input type textShortMessage). But it isn't a generic feature.
See Link Android Keyboard with Emoji
Thanks and enjoy...

Intercept the input element selection inside of an Android webview

I have a WebView in my Android app that has a input element for a user to enter text into. When the user selects the input element the android keyboard is automatically displayed and can be used to enter text.
I want to use my own entry method instead. Is there a way to intercept the input element selection inside of a WebView and use my android app to inject the text into that input?
I would need a way to know when a input element in the WebView becomes focused/de-focused and be able to pass a string to display into that element.
To do DOM manipulation in the webview you're going to need to execute JavaScript in the webview. So to inject & remove your content, you will need to attach onblur & onfocus handlers to the input widget, and control the injecting of your content via Javascript.
To inject content from native code into the JS requires using JavaScript in the web view - that link describes how to bind Javascript to Android code.
To stop the soft keyboard from appearing it looks like setting android:windowSoftInputMode on the Activity is what you need.
If you want users to be able to use the soft keyboard elsewhere in the Activity, you'll need to to call back to Java code to toggle that property programatically using setSoftInputMode to enable the keyboard when required. (I imagine that trying to hide the keyboard when an input receives focus will result in the keyboard appearing, then quickly disappearing.)

Open Soft Keyboard with Specific Input Type

I'm using an HTML form in WebView. I want to open specific soft keyboard when my type is email or url. In app we can do it by specifying android:inputType="textEmailAddress" or android:inputType="textUri" in EditText.
In my scenario i do not have edit text. Well, using JavaScript Interface i'm able to call my java method whenever i focus on input type email or url in html. But i did not find any API to open soft keyboard of inputType textUri or textEmailAddress.
Does anyone knows how to do this? Thanks in advance.

Categories

Resources